@streamplace/components 0.7.35 → 0.8.3
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/dist/components/content-metadata/content-metadata-form.js +467 -0
- package/dist/components/content-metadata/content-rights.js +78 -0
- package/dist/components/content-metadata/content-warnings.js +68 -0
- package/dist/components/content-metadata/index.js +11 -0
- package/dist/components/mobile-player/player.js +4 -0
- package/dist/components/mobile-player/ui/report-modal.js +3 -2
- package/dist/components/ui/checkbox.js +87 -0
- package/dist/components/ui/dialog.js +188 -83
- package/dist/components/ui/primitives/input.js +13 -1
- package/dist/components/ui/primitives/modal.js +2 -2
- package/dist/components/ui/select.js +89 -0
- package/dist/components/ui/textarea.js +23 -4
- package/dist/components/ui/toast.js +464 -114
- package/dist/components/ui/tooltip.js +103 -0
- package/dist/index.js +2 -0
- package/dist/lib/metadata-constants.js +157 -0
- package/dist/lib/theme/theme.js +5 -3
- package/dist/streamplace-provider/index.js +14 -4
- package/dist/streamplace-store/content-metadata-actions.js +124 -0
- package/dist/streamplace-store/streamplace-store.js +22 -5
- package/dist/streamplace-store/user.js +67 -7
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +3 -3
- package/src/components/content-metadata/content-metadata-form.tsx +893 -0
- package/src/components/content-metadata/content-rights.tsx +104 -0
- package/src/components/content-metadata/content-warnings.tsx +100 -0
- package/src/components/content-metadata/index.tsx +10 -0
- package/src/components/mobile-player/player.tsx +5 -0
- package/src/components/mobile-player/ui/report-modal.tsx +13 -7
- package/src/components/ui/checkbox.tsx +147 -0
- package/src/components/ui/dialog.tsx +319 -99
- package/src/components/ui/primitives/input.tsx +19 -2
- package/src/components/ui/primitives/modal.tsx +4 -2
- package/src/components/ui/select.tsx +175 -0
- package/src/components/ui/textarea.tsx +47 -29
- package/src/components/ui/toast.tsx +785 -179
- package/src/components/ui/tooltip.tsx +131 -0
- package/src/index.tsx +3 -0
- package/src/lib/metadata-constants.ts +180 -0
- package/src/lib/theme/theme.tsx +10 -6
- package/src/streamplace-provider/index.tsx +20 -2
- package/src/streamplace-store/content-metadata-actions.tsx +145 -0
- package/src/streamplace-store/streamplace-store.tsx +41 -4
- package/src/streamplace-store/user.tsx +71 -7
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,18 +10,36 @@ export function useGetChatProfile() {
|
|
|
10
10
|
const did = useDID();
|
|
11
11
|
const pdsAgent = usePDSAgent();
|
|
12
12
|
const store = getStreamplaceStoreFromContext();
|
|
13
|
+
const createEmptyChatProfile = useCreateEmptyChatProfile();
|
|
13
14
|
|
|
14
15
|
return async () => {
|
|
15
16
|
if (!did || !pdsAgent) {
|
|
16
17
|
throw new Error("No DID or PDS agent");
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
let res;
|
|
20
|
+
try {
|
|
21
|
+
res = await pdsAgent.com.atproto.repo.getRecord({
|
|
22
|
+
repo: did,
|
|
23
|
+
collection: "place.stream.chat.profile",
|
|
24
|
+
rkey: "self",
|
|
25
|
+
});
|
|
26
|
+
} catch (e) {
|
|
27
|
+
console.error(
|
|
28
|
+
"Failed to get chat profile record, attempting creation",
|
|
29
|
+
e,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (!res || !res.success) {
|
|
33
|
+
try {
|
|
34
|
+
await createEmptyChatProfile();
|
|
35
|
+
res = await pdsAgent.com.atproto.repo.getRecord({
|
|
36
|
+
repo: did,
|
|
37
|
+
collection: "place.stream.chat.profile",
|
|
38
|
+
rkey: "self",
|
|
39
|
+
});
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.error("Failed to create empty chat profile record", e);
|
|
42
|
+
}
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
if (PlaceStreamChatProfile.isRecord(res.data.value)) {
|
|
@@ -32,6 +50,30 @@ export function useGetChatProfile() {
|
|
|
32
50
|
};
|
|
33
51
|
}
|
|
34
52
|
|
|
53
|
+
export function useCreateEmptyChatProfile() {
|
|
54
|
+
const did = useDID();
|
|
55
|
+
const pdsAgent = usePDSAgent();
|
|
56
|
+
|
|
57
|
+
return async () => {
|
|
58
|
+
if (!did || !pdsAgent) {
|
|
59
|
+
throw new Error("No DID or PDS agent");
|
|
60
|
+
}
|
|
61
|
+
const res = await pdsAgent.com.atproto.repo.putRecord({
|
|
62
|
+
repo: did,
|
|
63
|
+
collection: "place.stream.chat.profile",
|
|
64
|
+
rkey: "self",
|
|
65
|
+
record: {
|
|
66
|
+
$type: "place.stream.chat.profile",
|
|
67
|
+
color:
|
|
68
|
+
DEFAULT_COLORS[Math.floor(Math.random() * DEFAULT_COLORS.length)],
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
if (!res.success) {
|
|
72
|
+
throw new Error("Failed to create empty chat profile record");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
35
77
|
export function useGetBskyProfile() {
|
|
36
78
|
const did = useDID();
|
|
37
79
|
const pdsAgent = usePDSAgent();
|
|
@@ -55,3 +97,25 @@ export function useGetBskyProfile() {
|
|
|
55
97
|
export function useChatProfile() {
|
|
56
98
|
return useStreamplaceStore((x) => x.chatProfile);
|
|
57
99
|
}
|
|
100
|
+
|
|
101
|
+
const DEFAULT_COLORS: PlaceStreamChatProfile.Color[] = [
|
|
102
|
+
{ red: 244, green: 67, blue: 54 },
|
|
103
|
+
{ red: 233, green: 30, blue: 99 },
|
|
104
|
+
{ red: 156, green: 39, blue: 176 },
|
|
105
|
+
{ red: 103, green: 58, blue: 183 },
|
|
106
|
+
{ red: 63, green: 81, blue: 181 },
|
|
107
|
+
{ red: 33, green: 150, blue: 243 },
|
|
108
|
+
{ red: 3, green: 169, blue: 244 },
|
|
109
|
+
{ red: 0, green: 188, blue: 212 },
|
|
110
|
+
{ red: 0, green: 150, blue: 136 },
|
|
111
|
+
{ red: 76, green: 175, blue: 80 },
|
|
112
|
+
{ red: 139, green: 195, blue: 74 },
|
|
113
|
+
{ red: 205, green: 220, blue: 57 },
|
|
114
|
+
{ red: 255, green: 235, blue: 59 },
|
|
115
|
+
{ red: 255, green: 193, blue: 7 },
|
|
116
|
+
{ red: 255, green: 152, blue: 0 },
|
|
117
|
+
{ red: 255, green: 87, blue: 34 },
|
|
118
|
+
{ red: 121, green: 85, blue: 72 },
|
|
119
|
+
{ red: 158, green: 158, blue: 158 },
|
|
120
|
+
{ red: 96, green: 125, blue: 139 },
|
|
121
|
+
];
|