feat(rust): Teams from first-party clans (phase 9, protocol 6)
A first-party Rust clan is a Team (R5). This module becomes the site's Team provider and answers core from the plugin's `clans` board. Design of record: docs/modules/rust/PLAN.md §24, D47-D58. - The store: rust_clans, rust_clan_members and rust_clan_boards. A clan's identity is <serverId>:<clanId>:<createdMs> (D52), because the game restarts clan ids whenever its clan database version changes. - The provider (D53): getTeams is complete only when every server's board is fresh, supported and untruncated. It is partial when some are, and refuses when none are. Freshness is judged by the website's clock, from when the board's `t` last advanced. - Only a complete board may mark a clan gone. A board at the game's 100-clan ceiling (D55), or one with an unreadable row, proves nothing about what it leaves out. - Leadership is diffed board to board and published (D54). The five clan events are published as team.* kinds, and written to the Team feed as members-only lines (D49). - Core only writes feed items for a Team it already holds. So the last 10 minutes of clan events are re-offered on each board refresh, deduped by a sha1 key: core clamps a dedupeKey to 40 characters, and a readable key would be truncated into collisions. - projectRoster and the clan page share one audience rule (D48): the clan's linked members and staff by default, re-read from the users row. The setting lives on Admin > Rust visibility, which also warns about uMod Clans (D47) and the ceiling. - Public: GET servers/:id/clans (the list is public, D58) and GET clans/:externalId. The client adds a Clans tab and /rust/clans/:externalId, with three module slots for core's notify, activity and forum contributions (D56). - Linking and unlinking an account ask core to reconcile Teams (D57). - The clan kinds are staff-class in the public feed allowlist. - PROTOCOL_VERSION is now 6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -47,6 +47,21 @@ export const servers = {
|
||||
wipes: (id) => req(`/public/rust/servers/${encodeURIComponent(id)}/wipes`),
|
||||
|
||||
online: (id) => req(`/public/rust/servers/${encodeURIComponent(id)}/online`),
|
||||
|
||||
// Phase 9. The clan list is public (D58): name, colour, score and member count
|
||||
// name nobody. `board` says whether the list can be trusted right now.
|
||||
clans: (id) => req(`/public/rust/servers/${encodeURIComponent(id)}/clans`),
|
||||
}
|
||||
|
||||
// One clan. Its roster comes back only for a viewer inside the operator's roster
|
||||
// audience (D48) — clan members and staff by default — and `roster.visible`
|
||||
// says which answer this was, so a page can explain an empty roster rather than
|
||||
// imply an empty clan.
|
||||
//
|
||||
// The id carries colons (`<server>:<clan>:<created>`). They are legal in a path
|
||||
// segment, and encoded anyway so that a server slug is never read as structure.
|
||||
export const clans = {
|
||||
get: (externalId) => req(`/public/rust/clans/${encodeURIComponent(externalId)}`),
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,6 +246,7 @@ export { BASE, query }
|
||||
|
||||
export default {
|
||||
servers,
|
||||
clans,
|
||||
playerServers,
|
||||
playerLinks,
|
||||
playerPermissions,
|
||||
|
||||
118
client/src/components/Clans.jsx
Normal file
118
client/src/components/Clans.jsx
Normal file
@@ -0,0 +1,118 @@
|
||||
// ── The clans on one server ───────────────────────────────────────────────
|
||||
//
|
||||
// Rust's OWN clans (R5), best score first. Public at every setting (D58): a
|
||||
// clan's name, colour, score and member count name nobody. Who is IN a clan is
|
||||
// the roster, and that lives on the clan's own page behind the operator's
|
||||
// roster audience (D48).
|
||||
//
|
||||
// **The list is only as good as the board it came from**, and the answer says
|
||||
// how good that is. Three cases would all look like an empty list if rendered
|
||||
// bare, and they are three different sentences:
|
||||
//
|
||||
// • the bridge cannot read this server's clans at all (an older plugin, or a
|
||||
// Nexus server whose clans live elsewhere) — "unavailable";
|
||||
// • the game's clan system is switched off — "this server has no clans";
|
||||
// • it can, and there are none — "nobody has founded one yet".
|
||||
//
|
||||
// And a board at the game's 100-clan ceiling (D55) says there may be more.
|
||||
|
||||
import { Link } from 'react-router-dom'
|
||||
import { ErrorState, Loading, useAsync } from '../core.js'
|
||||
import Empty from './Empty.jsx'
|
||||
import { count } from '../lib/format.js'
|
||||
import api from '../api.js'
|
||||
|
||||
export default function Clans({ serverId }) {
|
||||
const { data, loading, error } = useAsync(() => api.servers.clans(serverId), [serverId])
|
||||
|
||||
if (loading) return <Loading />
|
||||
if (error) return <ErrorState error={error} />
|
||||
|
||||
const clans = (data && data.clans) || []
|
||||
const board = (data && data.board) || {}
|
||||
|
||||
if (clans.length === 0) {
|
||||
if (!board.supported) {
|
||||
return (
|
||||
<Empty
|
||||
title="Clans are unavailable for this server"
|
||||
message={board.reason ? `${capitalise(board.reason)}.` : 'The bridge has not reported this server’s clans yet.'}
|
||||
/>
|
||||
)
|
||||
}
|
||||
if (board.enabled === false) {
|
||||
return <Empty title="This server has no clans" message="Its operator has switched the game’s clan system off." />
|
||||
}
|
||||
return <Empty title="No clans yet" message="Nobody on this server has founded a clan." />
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{board.truncated && (
|
||||
<p className="sans" style={{ color: 'var(--dim)', fontSize: '0.8rem', marginTop: 0 }}>
|
||||
The game lists at most 100 clans, by score, so there may be more on this server than are shown here.
|
||||
</p>
|
||||
)}
|
||||
<ul style={{ listStyle: 'none', margin: 0, padding: 0 }}>
|
||||
{clans.map((clan, index) => (
|
||||
<li
|
||||
key={clan.externalId}
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'baseline',
|
||||
gap: 12,
|
||||
padding: '10px 0',
|
||||
borderBottom: '1px solid var(--line-soft, var(--line))',
|
||||
}}
|
||||
>
|
||||
<span className="sans" style={{ color: 'var(--dim)', fontSize: '0.78rem', minWidth: 22, textAlign: 'right' }}>
|
||||
{index + 1}
|
||||
</span>
|
||||
<Swatch color={clan.color} />
|
||||
<Link to={clanPath(clan.externalId)} style={{ fontWeight: 600, flex: 1, minWidth: 0 }}>
|
||||
{clan.name}
|
||||
</Link>
|
||||
<span className="sans" style={{ color: 'var(--dim)', fontSize: '0.8rem', whiteSpace: 'nowrap' }}>
|
||||
{count(clan.memberCount)} {clan.memberCount === 1 ? 'member' : 'members'}
|
||||
</span>
|
||||
<span className="sans" style={{ fontSize: '0.8rem', whiteSpace: 'nowrap', minWidth: 70, textAlign: 'right' }}>
|
||||
{count(clan.score)} pts
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/** Where a clan's page is: the same template the Team provider hands core. */
|
||||
export function clanPath(externalId) {
|
||||
return `/rust/clans/${encodeURIComponent(externalId)}`
|
||||
}
|
||||
|
||||
/**
|
||||
* A clan's colour, as a small square. The server has already checked it is a
|
||||
* `#rrggbb` — it ends up in a style — and a clan with no colour gets an outline
|
||||
* rather than a guess.
|
||||
*/
|
||||
export function Swatch({ color, size = 12 }) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
style={{
|
||||
display: 'inline-block',
|
||||
flex: 'none',
|
||||
width: size,
|
||||
height: size,
|
||||
borderRadius: 3,
|
||||
background: color || 'transparent',
|
||||
border: color ? 'none' : '1px solid var(--line)',
|
||||
alignSelf: 'center',
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function capitalise(text) {
|
||||
return text ? text.charAt(0).toUpperCase() + text.slice(1) : text
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import { registry, coreApiVersion } from './core.js'
|
||||
|
||||
import Servers from './routes/public/Servers.jsx'
|
||||
import ServerDetail from './routes/public/ServerDetail.jsx'
|
||||
import Clan from './routes/public/Clan.jsx'
|
||||
import Account from './routes/player/Account.jsx'
|
||||
import Permissions from './routes/admin/Permissions.jsx'
|
||||
import ModConfig from './routes/admin/ModConfig.jsx'
|
||||
@@ -82,6 +83,10 @@ registry.registerRoutes(ID, {
|
||||
public: [
|
||||
{ path: '', element: <Servers /> },
|
||||
{ path: 'servers/:id', element: <ServerDetail /> },
|
||||
// Phase 9 (D56). Not nested under its server: core links here from Team
|
||||
// notification email through `pageUrlTemplate`, which substitutes
|
||||
// `{externalId}` and nothing else — and the server is inside that id.
|
||||
{ path: 'clans/:externalId', element: <Clan /> },
|
||||
],
|
||||
player: [{ path: '', element: <Account /> }],
|
||||
admin: [
|
||||
@@ -175,6 +180,22 @@ registry.registerExtension(ID, 'site.footer.status', FooterStatus)
|
||||
// no linked Steam account, which is most of them.
|
||||
registry.registerExtension(ID, 'admin.users.detail', UserRustSections)
|
||||
|
||||
// ── Inverted slots: core's Team contributions on OUR clan page ─────────────
|
||||
//
|
||||
// §3.7a. A clan is a Team (R5), and core renders no Team page because it does
|
||||
// not own the word "clan". So the page is `routes/public/Clan.jsx` and core
|
||||
// contributes the three things only it can render — into places this module
|
||||
// names, in this module's vocabulary. Core offers a CONTRIBUTION; it never names
|
||||
// a slot, which is what lets a second game use the same contract as module-uo.
|
||||
//
|
||||
// One slot per PLACE (D56): a slot holds one component, and a collapsed slot
|
||||
// would hand core the decision about where each part sits on a page it does not
|
||||
// own. Asking for a contribution core does not offer throws here, at
|
||||
// registration — a typo fails loudly rather than rendering nothing for ever.
|
||||
registry.declareModuleSlot(ID, 'rust.clan.header', { core: 'team.notify' })
|
||||
registry.declareModuleSlot(ID, 'rust.clan.detail', { core: 'team.activity' })
|
||||
registry.declareModuleSlot(ID, 'rust.clan.forum', { core: 'team.forum' })
|
||||
|
||||
// `module.json`'s `coreApi` range was checked by the loader before this file was
|
||||
// ever served, so there is nothing to re-check here. Log it anyway: a mismatch
|
||||
// between the core that validated the manifest and the core that published this
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
// The page says what "who is online" covers, because it is wider than the tab
|
||||
// of the same name: the killfeed, chat and joins in the feed, and the
|
||||
// leaderboard's "last seen" all name a player who was on at a given moment.
|
||||
//
|
||||
// Phase 9 adds a second setting beside it: who may see a CLAN ROSTER (D48). It
|
||||
// defaults to the clan's own members and staff, and widening it widens online
|
||||
// status too, because a roster row carries it — the page says so. The same card
|
||||
// lists each server's clan board: a server whose clans cannot be read, one at
|
||||
// the game's 100-clan ceiling (D55), and one running the uMod Clans plugin,
|
||||
// whose clans are a separate system and never Teams (D47).
|
||||
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
|
||||
@@ -26,6 +33,18 @@ const LABEL = {
|
||||
public: 'Everyone',
|
||||
}
|
||||
|
||||
const CLAN_LABEL = {
|
||||
members: 'The clan’s members and staff',
|
||||
signed_in: 'Signed-in members',
|
||||
public: 'Everyone',
|
||||
}
|
||||
|
||||
const CLAN_DESCRIBE = {
|
||||
members: 'Players whose linked Rust account is in the clan, plus admins and moderators. The default.',
|
||||
signed_in: 'Anybody with an account on this site.',
|
||||
public: 'Anybody at all, signed in or not.',
|
||||
}
|
||||
|
||||
const DESCRIBE = {
|
||||
staff: 'Admins and moderators. The default.',
|
||||
signed_in: 'Anybody with an account on this site.',
|
||||
@@ -66,6 +85,7 @@ export default function Visibility() {
|
||||
const { data, error: loadError } = useAsync(() => api.adminVisibility.read(), [reloads])
|
||||
|
||||
const [fleet, setFleet] = useState('staff')
|
||||
const [clanRoster, setClanRoster] = useState('members')
|
||||
const [servers, setServers] = useState({})
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
@@ -76,6 +96,7 @@ export default function Visibility() {
|
||||
// the site's word rather than what this page sent.
|
||||
const load = useCallback((state) => {
|
||||
setFleet(state.presence.fleet)
|
||||
setClanRoster((state.clans && state.clans.roster) || 'members')
|
||||
setServers(Object.fromEntries(state.presence.servers.map((s) => [s.id, s.override || INHERIT])))
|
||||
}, [])
|
||||
|
||||
@@ -91,7 +112,9 @@ export default function Visibility() {
|
||||
|
||||
const dirtyFleet = fleet !== data.presence.fleet
|
||||
const dirtyServers = rows.filter((s) => (servers[s.id] ?? INHERIT) !== (s.override || INHERIT))
|
||||
const dirty = dirtyFleet || dirtyServers.length > 0
|
||||
const clans = data.clans || { audiences: [], roster: 'members', servers: [] }
|
||||
const dirtyClans = clanRoster !== clans.roster
|
||||
const dirty = dirtyFleet || dirtyServers.length > 0 || dirtyClans
|
||||
|
||||
const effective = (id) => servers[id] || fleet
|
||||
const widened = fleet !== 'staff' || rows.some((s) => effective(s.id) !== 'staff')
|
||||
@@ -104,6 +127,7 @@ export default function Visibility() {
|
||||
try {
|
||||
const body = {}
|
||||
if (dirtyFleet) body.fleet = fleet
|
||||
if (dirtyClans) body.clanRoster = clanRoster
|
||||
if (dirtyServers.length) {
|
||||
body.servers = Object.fromEntries(dirtyServers.map((s) => [s.id, servers[s.id] || null]))
|
||||
}
|
||||
@@ -175,6 +199,32 @@ export default function Visibility() {
|
||||
</p>
|
||||
)}
|
||||
|
||||
<Card title="Clan rosters" subtitle="who is in each clan, on every server">
|
||||
<div className="sans" style={{ display: 'flex', alignItems: 'center', gap: 12, fontSize: '0.86rem' }}>
|
||||
<select
|
||||
value={clanRoster}
|
||||
onChange={(e) => setClanRoster(e.target.value)}
|
||||
style={selectStyle}
|
||||
aria-label="Who may see a clan roster"
|
||||
>
|
||||
{clans.audiences.map((a) => (
|
||||
<option key={a} value={a}>{CLAN_LABEL[a] || a}</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="dim" style={{ fontSize: '0.78rem' }}>{CLAN_DESCRIBE[clanRoster]}</span>
|
||||
</div>
|
||||
<p className="sans dim" style={{ fontSize: '0.78rem', margin: '10px 0 0' }}>
|
||||
Each clan’s name, colour, score and member count are always public.
|
||||
</p>
|
||||
{clanRoster !== 'members' && (
|
||||
<p className="sans" style={{ color: '#d08a2a', fontSize: '0.8rem', margin: '8px 0 0' }}>
|
||||
A roster also shows which members are online right now, so this shows who is on to{' '}
|
||||
{clanRoster === 'public' ? 'everyone' : 'every signed-in member'} as well.
|
||||
</p>
|
||||
)}
|
||||
<ClanBoards servers={clans.servers || []} />
|
||||
</Card>
|
||||
|
||||
<div className="sans" style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
||||
<button type="submit" className="btn" disabled={busy || !dirty}>
|
||||
{busy ? 'Saving…' : 'Save'}
|
||||
@@ -186,6 +236,38 @@ export default function Visibility() {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* What each server's clan board says about itself. Only the servers with
|
||||
* something to report are listed: a board that is current, complete and read
|
||||
* normally is the case that needs no sentence.
|
||||
*/
|
||||
function ClanBoards({ servers }) {
|
||||
const notes = []
|
||||
for (const s of servers) {
|
||||
if (s.umodClans) {
|
||||
notes.push([s, 'is running the uMod Clans plugin. Its clans are a separate system from the game’s own, and only the game’s clans appear on this site.'])
|
||||
}
|
||||
if (!s.supported) {
|
||||
notes.push([s, s.reason ? `cannot report its clans: ${s.reason}.` : 'has not reported its clans yet.'])
|
||||
} else if (s.truncated) {
|
||||
notes.push([s, 'is at the game’s limit of 100 listed clans, so clans beyond the top 100 by score are not shown, and a disbanded clan is not removed until it drops below.'])
|
||||
} else if (!s.fresh) {
|
||||
notes.push([s, 'has not reported its clans recently, so they are shown as last reported.'])
|
||||
}
|
||||
}
|
||||
if (!notes.length) return null
|
||||
return (
|
||||
<ul className="sans" style={{ margin: '12px 0 0', paddingLeft: 18, fontSize: '0.8rem' }}>
|
||||
{notes.map(([s, text], i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<li key={`${s.id}-${i}`} style={{ margin: '4px 0' }}>
|
||||
<strong style={{ color: 'var(--head)' }}>{s.name}</strong> {text}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
const selectStyle = {
|
||||
background: 'var(--panel-flat, transparent)',
|
||||
color: 'var(--text)',
|
||||
|
||||
161
client/src/routes/public/Clan.jsx
Normal file
161
client/src/routes/public/Clan.jsx
Normal file
@@ -0,0 +1,161 @@
|
||||
// ── One clan ──────────────────────────────────────────────────────────────
|
||||
//
|
||||
// A first-party Rust clan is a Team (R5), and this is its page. Core owns the
|
||||
// Team — the reconciler, the access rules, the activity feed, the forum — but
|
||||
// not the word "clan", so it publishes no Team page of its own (MODULE_API.md
|
||||
// §3.7a). The page is this module's, and the three parts only core can render
|
||||
// are contributed into places this page names:
|
||||
//
|
||||
// rust.clan.header ← core's `team.notify` (above the roster: an action ON the page)
|
||||
// rust.clan.detail ← core's `team.activity` (the members-only feed, D49)
|
||||
// rust.clan.forum ← core's `team.forum`
|
||||
//
|
||||
// One slot per PLACE, as module-uo does, so core never decides the layout of a
|
||||
// page it does not own. **Every slot may be empty** — a core without Teams, a
|
||||
// deployment with the forum switched off, a clan whose Team core has not created
|
||||
// yet — and the page has to read correctly anyway. That is the phase criterion,
|
||||
// and it is why nothing here says "see below" about something core may not put
|
||||
// below.
|
||||
//
|
||||
// The roster comes from this module's own board, through the same function core
|
||||
// asks when it projects a roster (D48), so the two cannot disagree about who may
|
||||
// look. Below the audience the clan is still described — its name, score and
|
||||
// count are public (D58) — and the roster says who may see it instead.
|
||||
|
||||
import { useParams, Link } from 'react-router-dom'
|
||||
import { ErrorState, Loading, PageHeader, PublicLayout, Slot, useAsync } from '../../core.js'
|
||||
import Empty from '../../components/Empty.jsx'
|
||||
import { Swatch } from '../../components/Clans.jsx'
|
||||
import { count, day } from '../../lib/format.js'
|
||||
import api from '../../api.js'
|
||||
|
||||
const ID = 'rust'
|
||||
|
||||
export default function Clan() {
|
||||
const { externalId } = useParams()
|
||||
const { data, loading, error } = useAsync(() => api.clans.get(externalId), [externalId])
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<PublicLayout shell="mid">
|
||||
<Loading />
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
// A mistyped or out-of-date address is not an outage, and must not read as
|
||||
// one — the same rule the server page learned in phase 4.
|
||||
if (error || !data || !data.clan) {
|
||||
const missing = !error || error.status === 404
|
||||
return (
|
||||
<PublicLayout shell="mid">
|
||||
<PageHeader
|
||||
title={missing ? 'No such clan' : 'That clan could not be loaded'}
|
||||
lead={
|
||||
missing
|
||||
? 'This address does not name a clan this site knows about.'
|
||||
: 'The site could not read this clan just now. It is worth trying again.'
|
||||
}
|
||||
/>
|
||||
{!missing && <ErrorState error={error} />}
|
||||
<p className="sans" style={{ marginTop: 20 }}>
|
||||
<Link to="/rust">Back to the server list</Link>
|
||||
</p>
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
const { clan, roster } = data
|
||||
const serverLink = `/rust/servers/${encodeURIComponent(clan.serverId)}?tab=clans`
|
||||
|
||||
return (
|
||||
<PublicLayout shell="mid">
|
||||
<p className="sans" style={{ margin: '0 0 12px' }}>
|
||||
<Link to={serverLink}>← Clans on {clan.serverName || clan.serverId}</Link>
|
||||
</p>
|
||||
|
||||
<PageHeader eyebrow="Rust clan" title={clan.name} lead={describe(clan)} />
|
||||
|
||||
{clan.gone && (
|
||||
<p className="sans" style={{ color: 'var(--dim)', marginTop: 0 }}>
|
||||
This clan has been disbanded, or has left its server’s clan list. What is shown is the last the site heard.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<Slot name="rust.clan.header" externalId={clan.externalId} moduleId={ID} />
|
||||
|
||||
<h2 className="sans" style={{ fontSize: '1rem', margin: '24px 0 8px' }}>Members</h2>
|
||||
<Roster roster={roster} memberCount={clan.memberCount} gone={clan.gone} />
|
||||
|
||||
<Slot name="rust.clan.detail" externalId={clan.externalId} moduleId={ID} />
|
||||
|
||||
<Slot name="rust.clan.forum" externalId={clan.externalId} moduleId={ID} />
|
||||
</PublicLayout>
|
||||
)
|
||||
}
|
||||
|
||||
function describe(clan) {
|
||||
const parts = [
|
||||
<Swatch key="c" color={clan.color} />,
|
||||
` ${count(clan.memberCount)} ${clan.memberCount === 1 ? 'member' : 'members'}`,
|
||||
clan.maxMembers ? ` of ${count(clan.maxMembers)}` : '',
|
||||
` · ${count(clan.score)} points`,
|
||||
clan.founded ? ` · founded ${day(clan.founded)}` : '',
|
||||
]
|
||||
return <span>{parts}</span>
|
||||
}
|
||||
|
||||
function Roster({ roster, memberCount, gone }) {
|
||||
if (!roster || !roster.visible) {
|
||||
return <Empty title={`${count(memberCount)} ${memberCount === 1 ? 'member' : 'members'}`} message={withheld(roster && roster.audience)} />
|
||||
}
|
||||
|
||||
if (roster.members.length === 0) {
|
||||
return gone
|
||||
? <Empty title="No roster" message="A clan that has left its server’s list has no members to show." />
|
||||
: <Empty title="No roster yet" message="The server has not sent this clan’s members yet." />
|
||||
}
|
||||
|
||||
return (
|
||||
<ul style={{ listStyle: 'none', margin: 0, padding: 0 }}>
|
||||
{roster.members.map((m, i) => (
|
||||
<li
|
||||
// The roster carries no identifier on purpose (a Steam id and a site
|
||||
// account are withheld from every public roster), so the row's place is
|
||||
// its key. The list is re-rendered whole, never reordered in place.
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={i}
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'baseline',
|
||||
gap: 12,
|
||||
padding: '8px 0',
|
||||
borderBottom: '1px solid var(--line-soft, var(--line))',
|
||||
}}
|
||||
>
|
||||
<strong style={{ color: 'var(--ink)', flex: 1, minWidth: 0 }}>
|
||||
{m.name || 'Unknown player'}
|
||||
{m.leader && (
|
||||
<span className="sans" style={{ color: 'var(--accent)', marginLeft: 8, fontSize: '0.72rem' }}>Leader</span>
|
||||
)}
|
||||
</strong>
|
||||
{m.role && !m.leader && (
|
||||
<span className="sans" style={{ color: 'var(--dim)', fontSize: '0.8rem' }}>{m.role}</span>
|
||||
)}
|
||||
{/* Inside the roster audience by construction (D48): a viewer who may
|
||||
not see the roster sees no row to hang this on. */}
|
||||
<span className="sans" style={{ color: m.online ? 'var(--mode-live, #5fb98a)' : 'var(--dim)', fontSize: '0.78rem', whiteSpace: 'nowrap' }}>
|
||||
{m.online ? 'online' : ''}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
/** Why the roster was withheld, in words a visitor can act on. */
|
||||
function withheld(audience) {
|
||||
if (audience === 'signed_in') return 'Sign in to see who is in this clan.'
|
||||
if (audience === 'public') return 'This site is not showing clan rosters right now.'
|
||||
return 'Only this clan’s own members, with a linked Rust account, and this site’s staff can see who is in it.'
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
import { useSearchParams, useParams, Link } from 'react-router-dom'
|
||||
import { ErrorState, Loading, PageHeader, PublicLayout, useAsync } from '../../core.js'
|
||||
import Clans from '../../components/Clans.jsx'
|
||||
import Feed from '../../components/Feed.jsx'
|
||||
import Leaderboard from '../../components/Leaderboard.jsx'
|
||||
import Online from '../../components/Online.jsx'
|
||||
@@ -37,6 +38,8 @@ const TABS = [
|
||||
{ id: 'leaderboard', label: 'Leaderboard' },
|
||||
{ id: 'online', label: 'Online' },
|
||||
{ id: 'wipes', label: 'Wipes' },
|
||||
// Phase 9. The list is public (D58); each clan's roster is on its own page.
|
||||
{ id: 'clans', label: 'Clans' },
|
||||
]
|
||||
|
||||
export default function ServerDetail() {
|
||||
@@ -152,6 +155,8 @@ export default function ServerDetail() {
|
||||
|
||||
{tab === 'online' && <Online serverId={server.id} online={server.online} />}
|
||||
|
||||
{tab === 'clans' && <Clans serverId={server.id} />}
|
||||
|
||||
{tab === 'wipes' && (
|
||||
<Wipes
|
||||
serverId={server.id}
|
||||
|
||||
@@ -257,6 +257,23 @@ it('every declared slot names a core contribution core actually offers', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('the clan page gets all three of core’s Team contributions, one per place (phase 9, D56)', () => {
|
||||
// Core contributes three things to a Team page it does not own. Each has its
|
||||
// own place on the clan page, so no contribution is decided by another's
|
||||
// position — and a slot missing here is a clan page with no feed, no forum or
|
||||
// no notification switch, with nothing logged anywhere.
|
||||
const byName = Object.fromEntries(registered.declaredSlots.map((s) => [s.name, s.wants]))
|
||||
assert.deepEqual(byName, {
|
||||
'rust.clan.header': 'team.notify',
|
||||
'rust.clan.detail': 'team.activity',
|
||||
'rust.clan.forum': 'team.forum',
|
||||
})
|
||||
|
||||
// And the page is at the address the Team provider hands core.
|
||||
const paths = registered.routes.public.map((r) => r.path)
|
||||
assert.ok(paths.includes('rust/clans/:externalId'), paths.join(', '))
|
||||
})
|
||||
|
||||
it('registers under exactly one module id, matching the manifest', () => {
|
||||
const owners = new Set([
|
||||
...Object.values(registered.routes).flat().map((r) => r.moduleId),
|
||||
|
||||
Reference in New Issue
Block a user