@meith/theme-phasebook 0.28.0 → 0.29.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 +4 -4
- package/src/shared.tsx +15 -1
- package/src/slots/member-profile.tsx +7 -2
- package/src/slots/post-bit.tsx +6 -1
- package/src/theme.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meith/theme-phasebook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "A theme for Meith with a familiar social shape, built on the default theme's slots.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@meith/theme-default": "^0.
|
|
24
|
-
"@meith/theme-kit": "^0.
|
|
25
|
-
"@meith/ui": "^0.
|
|
23
|
+
"@meith/theme-default": "^0.29.0",
|
|
24
|
+
"@meith/theme-kit": "^0.29.0",
|
|
25
|
+
"@meith/ui": "^0.29.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^19.2.0"
|
package/src/shared.tsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
CountModel,
|
|
3
|
+
GroupTagModel,
|
|
4
|
+
PrefixModel,
|
|
5
|
+
TimeModel,
|
|
6
|
+
UserRefModel,
|
|
7
|
+
} from '@meith/theme-kit'
|
|
2
8
|
import { Avatar, cn } from '@meith/ui'
|
|
3
9
|
|
|
4
10
|
export const PAGE = 'mx-auto w-full max-w-6xl px-3 sm:px-4'
|
|
@@ -183,3 +189,11 @@ export function count(value: CountModel): string {
|
|
|
183
189
|
export function plural(value: CountModel, one: string, many: string): string {
|
|
184
190
|
return value.value === 1 ? one : many
|
|
185
191
|
}
|
|
192
|
+
|
|
193
|
+
export function groupTags(
|
|
194
|
+
groups: readonly GroupTagModel[] | undefined,
|
|
195
|
+
title: string | null,
|
|
196
|
+
): readonly GroupTagModel[] {
|
|
197
|
+
if (groups !== undefined && groups.length > 0) return groups
|
|
198
|
+
return title === null ? [] : [{ title }]
|
|
199
|
+
}
|
|
@@ -2,12 +2,13 @@ import type { MemberProfileModel, SlotCopy } from '@meith/theme-kit'
|
|
|
2
2
|
import { fromSlotCopy } from '@meith/theme-kit'
|
|
3
3
|
import { cn } from '@meith/ui'
|
|
4
4
|
|
|
5
|
-
import { Circle, count, FEED, NUMERIC, PAGE, PILL, PILL_PRIMARY, Stamp } from '../shared'
|
|
5
|
+
import { Circle, count, FEED, groupTags, NUMERIC, PAGE, PILL, PILL_PRIMARY, Stamp } from '../shared'
|
|
6
6
|
|
|
7
7
|
export function MemberProfile({
|
|
8
8
|
user,
|
|
9
9
|
avatarUrl,
|
|
10
10
|
title,
|
|
11
|
+
groups,
|
|
11
12
|
joinedAt,
|
|
12
13
|
lastVisitAt,
|
|
13
14
|
postCount,
|
|
@@ -43,7 +44,11 @@ export function MemberProfile({
|
|
|
43
44
|
>
|
|
44
45
|
{user.username}
|
|
45
46
|
</h1>
|
|
46
|
-
{title
|
|
47
|
+
{groupTags(groups, title).map((group) => (
|
|
48
|
+
<p key={group.title} className="text-sm text-muted-foreground">
|
|
49
|
+
<span className={group.nameClass ?? undefined}>{group.title}</span>
|
|
50
|
+
</p>
|
|
51
|
+
))}
|
|
47
52
|
</div>
|
|
48
53
|
</div>
|
|
49
54
|
|
package/src/slots/post-bit.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { cn } from '@meith/ui'
|
|
|
5
5
|
import {
|
|
6
6
|
Circle,
|
|
7
7
|
count,
|
|
8
|
+
groupTags,
|
|
8
9
|
LINK,
|
|
9
10
|
MUTED_LINK,
|
|
10
11
|
NUMERIC,
|
|
@@ -155,7 +156,11 @@ export function PostBit({ post, select, regions, copy }: PostBitSlotModel & { co
|
|
|
155
156
|
<p className="flex flex-wrap items-center gap-x-2 gap-y-1.5 text-[0.9375rem] leading-snug">
|
|
156
157
|
<UserRef user={author} className="text-[0.9375rem]" />
|
|
157
158
|
{author.badge != null && <GroupBadge badge={author.badge} />}
|
|
158
|
-
{author.
|
|
159
|
+
{groupTags(author.groups, author.title).map((group) => (
|
|
160
|
+
<Tag key={group.title}>
|
|
161
|
+
<span className={group.nameClass ?? undefined}>{group.title}</span>
|
|
162
|
+
</Tag>
|
|
163
|
+
))}
|
|
159
164
|
</p>
|
|
160
165
|
|
|
161
166
|
<p className="mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
|
package/src/theme.ts
CHANGED