@meith/theme-default 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/copy.ts +316 -0
- package/src/index.ts +6 -6
- package/src/messages/en.json +189 -0
- package/src/messages/index.ts +5 -0
- package/src/panel-icons.tsx +1 -2
- package/src/shared.tsx +4 -6
- package/src/slots/announcement.tsx +15 -9
- package/src/slots/auth-page.tsx +3 -1
- package/src/slots/board-index.tsx +11 -4
- package/src/slots/board-stats.tsx +14 -12
- package/src/slots/category-block.tsx +1 -1
- package/src/slots/discovery-view.tsx +16 -15
- package/src/slots/error-notice.tsx +17 -9
- package/src/slots/footer.tsx +15 -4
- package/src/slots/forum-display.tsx +25 -20
- package/src/slots/forum-jump.tsx +1 -1
- package/src/slots/forum-row.tsx +16 -15
- package/src/slots/header.tsx +13 -3
- package/src/slots/latest-posts.tsx +21 -12
- package/src/slots/latest-threads.tsx +27 -16
- package/src/slots/member-profile.tsx +19 -15
- package/src/slots/navigation.tsx +7 -4
- package/src/slots/notice.tsx +12 -9
- package/src/slots/pagination.tsx +16 -10
- package/src/slots/panel-nav.tsx +37 -16
- package/src/slots/panel-page.tsx +15 -3
- package/src/slots/panel-shell.tsx +1 -7
- package/src/slots/post-actions.tsx +18 -11
- package/src/slots/post-bit.tsx +42 -20
- package/src/slots/post-form.tsx +7 -3
- package/src/slots/redirect-notice.tsx +16 -7
- package/src/slots/search-form.tsx +13 -9
- package/src/slots/search-results.tsx +27 -26
- package/src/slots/shell.tsx +4 -3
- package/src/slots/subforum-list.tsx +12 -9
- package/src/slots/thread-row.tsx +19 -18
- package/src/slots/thread-view.tsx +23 -13
- package/src/slots/user-panel.tsx +19 -14
- package/src/slots/who-is-online.tsx +35 -19
- package/src/theme.ts +90 -19
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { OnlineMemberModel, SlotCopy, WhoIsOnlineModel } from '@meith/theme-kit'
|
|
2
|
+
import { fromSlotCopy } from '@meith/theme-kit'
|
|
1
3
|
import { Badge } from '@meith/ui'
|
|
2
|
-
import type { OnlineMemberModel, WhoIsOnlineModel } from '@meith/theme-kit'
|
|
3
4
|
|
|
4
5
|
import { LINK, NUMERIC, Stamp, UserRef } from '../shared'
|
|
5
6
|
|
|
@@ -8,39 +9,45 @@ const VISIBLE_NAMES = 12
|
|
|
8
9
|
export function WhoIsOnline({
|
|
9
10
|
guestCount,
|
|
10
11
|
members,
|
|
12
|
+
memberCount,
|
|
11
13
|
total,
|
|
12
14
|
recordCount,
|
|
13
15
|
recordAt,
|
|
14
16
|
fullListHref,
|
|
15
|
-
|
|
17
|
+
copy,
|
|
18
|
+
}: WhoIsOnlineModel & { copy: SlotCopy }) {
|
|
16
19
|
const shown = members.slice(0, VISIBLE_NAMES)
|
|
17
20
|
const rest = members.slice(VISIBLE_NAMES)
|
|
18
21
|
|
|
22
|
+
const c = (key: string) => fromSlotCopy(copy, `default.whoIsOnline.${key}`)
|
|
23
|
+
|
|
19
24
|
return (
|
|
20
25
|
<section
|
|
21
26
|
aria-labelledby="who-is-online-heading"
|
|
22
27
|
className="flex flex-wrap items-baseline gap-x-3 gap-y-1"
|
|
23
28
|
>
|
|
24
29
|
<h2 id="who-is-online-heading" className="sr-only">
|
|
25
|
-
|
|
30
|
+
{c('heading')}
|
|
26
31
|
</h2>
|
|
27
32
|
|
|
28
33
|
<span className={NUMERIC}>
|
|
29
|
-
<span className="font-medium text-foreground">{total.
|
|
30
|
-
{
|
|
31
|
-
{
|
|
34
|
+
<span className="font-medium text-foreground">{total.label}</span> {c('online')}{' '}
|
|
35
|
+
{memberCount.label} {memberCount.value === 1 ? c('member.one') : c('member.other')}
|
|
36
|
+
{', '}
|
|
37
|
+
{guestCount.label} {guestCount.value === 1 ? c('guest.one') : c('guest.other')}
|
|
32
38
|
</span>
|
|
33
39
|
|
|
34
|
-
{
|
|
35
|
-
<span>
|
|
36
|
-
{guestCount === 0
|
|
37
|
-
? 'Nobody is reading the board right now.'
|
|
38
|
-
: 'Only guests are reading the board right now.'}
|
|
39
|
-
</span>
|
|
40
|
+
{memberCount.value === 0 ? (
|
|
41
|
+
<span>{guestCount.value === 0 ? c('nobody') : c('onlyGuests')}</span>
|
|
40
42
|
) : (
|
|
41
43
|
<div className="min-w-0">
|
|
42
44
|
{shown.map((member, index) => (
|
|
43
|
-
<Name
|
|
45
|
+
<Name
|
|
46
|
+
key={member.userId ?? member.username}
|
|
47
|
+
member={member}
|
|
48
|
+
first={index === 0}
|
|
49
|
+
copy={copy}
|
|
50
|
+
/>
|
|
44
51
|
))}
|
|
45
52
|
|
|
46
53
|
{rest.length > 0 && (
|
|
@@ -48,8 +55,8 @@ export function WhoIsOnline({
|
|
|
48
55
|
<summary
|
|
49
56
|
className={`inline cursor-default list-none ${LINK} [&::-webkit-details-marker]:hidden [&::marker]:content-none`}
|
|
50
57
|
>
|
|
51
|
-
{'
|
|
52
|
-
<span className={NUMERIC}>{rest.length
|
|
58
|
+
{' '}
|
|
59
|
+
{c('and')} <span className={NUMERIC}>{rest.length}</span> {c('more')}
|
|
53
60
|
</summary>
|
|
54
61
|
{': '}
|
|
55
62
|
{rest.map((member, index) => (
|
|
@@ -57,6 +64,7 @@ export function WhoIsOnline({
|
|
|
57
64
|
key={member.userId ?? member.username}
|
|
58
65
|
member={member}
|
|
59
66
|
first={index === 0}
|
|
67
|
+
copy={copy}
|
|
60
68
|
/>
|
|
61
69
|
))}
|
|
62
70
|
</details>
|
|
@@ -66,11 +74,11 @@ export function WhoIsOnline({
|
|
|
66
74
|
|
|
67
75
|
<span className="ms-auto flex flex-wrap items-baseline gap-x-3 gap-y-1">
|
|
68
76
|
<a href={fullListHref} className={`font-medium text-foreground ${LINK}`}>
|
|
69
|
-
|
|
77
|
+
{c('seeEveryone')}
|
|
70
78
|
</a>
|
|
71
79
|
{recordAt !== null && (
|
|
72
80
|
<span className={NUMERIC}>
|
|
73
|
-
|
|
81
|
+
{c('record')} {recordCount.label} on <Stamp at={recordAt} />
|
|
74
82
|
</span>
|
|
75
83
|
)}
|
|
76
84
|
</span>
|
|
@@ -78,7 +86,15 @@ export function WhoIsOnline({
|
|
|
78
86
|
)
|
|
79
87
|
}
|
|
80
88
|
|
|
81
|
-
function Name({
|
|
89
|
+
function Name({
|
|
90
|
+
member,
|
|
91
|
+
first,
|
|
92
|
+
copy,
|
|
93
|
+
}: {
|
|
94
|
+
member: OnlineMemberModel
|
|
95
|
+
first: boolean
|
|
96
|
+
copy: SlotCopy
|
|
97
|
+
}) {
|
|
82
98
|
return (
|
|
83
99
|
<>
|
|
84
100
|
{!first && ', '}
|
|
@@ -86,7 +102,7 @@ function Name({ member, first }: { member: OnlineMemberModel; first: boolean })
|
|
|
86
102
|
{member.isInvisible && (
|
|
87
103
|
<>
|
|
88
104
|
{' '}
|
|
89
|
-
<Badge tone="neutral">
|
|
105
|
+
<Badge tone="neutral">{fromSlotCopy(copy, 'default.whoIsOnline.invisible')}</Badge>
|
|
90
106
|
</>
|
|
91
107
|
)}
|
|
92
108
|
</>
|
package/src/theme.ts
CHANGED
|
@@ -1,38 +1,69 @@
|
|
|
1
1
|
import { defineTheme } from '@meith/theme-kit'
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
announcementCopy,
|
|
5
|
+
boardIndexCopy,
|
|
6
|
+
boardStatsCopy,
|
|
7
|
+
discoveryViewCopy,
|
|
8
|
+
errorNoticeCopy,
|
|
9
|
+
footerCopy,
|
|
10
|
+
forumDisplayCopy,
|
|
11
|
+
forumRowCopy,
|
|
12
|
+
headerCopy,
|
|
13
|
+
latestPostsCopy,
|
|
14
|
+
latestThreadsCopy,
|
|
15
|
+
memberProfileCopy,
|
|
16
|
+
navigationCopy,
|
|
17
|
+
noticeCopy,
|
|
18
|
+
paginationCopy,
|
|
19
|
+
panelNavCopy,
|
|
20
|
+
panelPageCopy,
|
|
21
|
+
postActionsCopy,
|
|
22
|
+
postBitCopy,
|
|
23
|
+
postFormCopy,
|
|
24
|
+
redirectNoticeCopy,
|
|
25
|
+
searchFormCopy,
|
|
26
|
+
searchResultsCopy,
|
|
27
|
+
shellCopy,
|
|
28
|
+
subforumListCopy,
|
|
29
|
+
threadRowCopy,
|
|
30
|
+
threadViewCopy,
|
|
31
|
+
userPanelCopy,
|
|
32
|
+
whoIsOnlineCopy,
|
|
33
|
+
} from './copy'
|
|
34
|
+
import { Announcement } from './slots/announcement'
|
|
35
|
+
import { AuthPage } from './slots/auth-page'
|
|
3
36
|
import { BoardIndex } from './slots/board-index'
|
|
4
37
|
import { BoardStats } from './slots/board-stats'
|
|
5
38
|
import { CategoryBlock } from './slots/category-block'
|
|
6
|
-
import {
|
|
39
|
+
import { DiscoveryView } from './slots/discovery-view'
|
|
40
|
+
import { ErrorNotice } from './slots/error-notice'
|
|
7
41
|
import { Footer } from './slots/footer'
|
|
42
|
+
import { ForumDisplay } from './slots/forum-display'
|
|
43
|
+
import { ForumJump } from './slots/forum-jump'
|
|
8
44
|
import { ForumRow } from './slots/forum-row'
|
|
45
|
+
import { Header } from './slots/header'
|
|
9
46
|
import { LatestPosts } from './slots/latest-posts'
|
|
10
47
|
import { LatestThreads } from './slots/latest-threads'
|
|
11
|
-
import {
|
|
12
|
-
import { Header } from './slots/header'
|
|
48
|
+
import { MemberProfile } from './slots/member-profile'
|
|
13
49
|
import { Navigation } from './slots/navigation'
|
|
14
50
|
import { Notice } from './slots/notice'
|
|
15
|
-
import { Announcement } from './slots/announcement'
|
|
16
|
-
import { Shell } from './slots/shell'
|
|
17
|
-
import { UserPanel } from './slots/user-panel'
|
|
18
51
|
import { Pagination } from './slots/pagination'
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
52
|
+
import { PanelNav } from './slots/panel-nav'
|
|
53
|
+
import { PanelPage, PanelSection } from './slots/panel-page'
|
|
54
|
+
import { PanelShell } from './slots/panel-shell'
|
|
55
|
+
import { PostActions } from './slots/post-actions'
|
|
22
56
|
import { PostBit } from './slots/post-bit'
|
|
23
57
|
import { PostForm } from './slots/post-form'
|
|
24
|
-
import {
|
|
25
|
-
import { MemberProfile } from './slots/member-profile'
|
|
26
|
-
import { ForumJump } from './slots/forum-jump'
|
|
58
|
+
import { RedirectNotice } from './slots/redirect-notice'
|
|
27
59
|
import { SearchForm } from './slots/search-form'
|
|
28
|
-
import { AuthPage } from './slots/auth-page'
|
|
29
60
|
import { SearchResults } from './slots/search-results'
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
61
|
+
import { Shell } from './slots/shell'
|
|
62
|
+
import { SubforumList } from './slots/subforum-list'
|
|
63
|
+
import { ThreadRow } from './slots/thread-row'
|
|
64
|
+
import { ThreadView } from './slots/thread-view'
|
|
65
|
+
import { UserPanel } from './slots/user-panel'
|
|
66
|
+
import { WhoIsOnline } from './slots/who-is-online'
|
|
36
67
|
|
|
37
68
|
export const defaultTheme = defineTheme({
|
|
38
69
|
key: 'default',
|
|
@@ -84,4 +115,44 @@ export const defaultTheme = defineTheme({
|
|
|
84
115
|
RedirectNotice,
|
|
85
116
|
ErrorNotice,
|
|
86
117
|
},
|
|
118
|
+
copy: {
|
|
119
|
+
Shell: shellCopy,
|
|
120
|
+
Header: headerCopy,
|
|
121
|
+
UserPanel: userPanelCopy,
|
|
122
|
+
Navigation: navigationCopy,
|
|
123
|
+
Footer: footerCopy,
|
|
124
|
+
Notice: noticeCopy,
|
|
125
|
+
Announcement: announcementCopy,
|
|
126
|
+
|
|
127
|
+
BoardIndex: boardIndexCopy,
|
|
128
|
+
ForumRow: forumRowCopy,
|
|
129
|
+
BoardStats: boardStatsCopy,
|
|
130
|
+
WhoIsOnline: whoIsOnlineCopy,
|
|
131
|
+
LatestThreads: latestThreadsCopy,
|
|
132
|
+
LatestPosts: latestPostsCopy,
|
|
133
|
+
|
|
134
|
+
ForumDisplay: forumDisplayCopy,
|
|
135
|
+
SubforumList: subforumListCopy,
|
|
136
|
+
ThreadRow: threadRowCopy,
|
|
137
|
+
Pagination: paginationCopy,
|
|
138
|
+
|
|
139
|
+
ThreadView: threadViewCopy,
|
|
140
|
+
PostBit: postBitCopy,
|
|
141
|
+
PostActions: postActionsCopy,
|
|
142
|
+
|
|
143
|
+
PostForm: postFormCopy,
|
|
144
|
+
|
|
145
|
+
MemberProfile: memberProfileCopy,
|
|
146
|
+
|
|
147
|
+
SearchForm: searchFormCopy,
|
|
148
|
+
SearchResults: searchResultsCopy,
|
|
149
|
+
|
|
150
|
+
DiscoveryView: discoveryViewCopy,
|
|
151
|
+
|
|
152
|
+
PanelNav: panelNavCopy,
|
|
153
|
+
PanelPage: panelPageCopy,
|
|
154
|
+
|
|
155
|
+
RedirectNotice: redirectNoticeCopy,
|
|
156
|
+
ErrorNotice: errorNoticeCopy,
|
|
157
|
+
},
|
|
87
158
|
})
|