frontend for xcvr appview
1export type Channel = {
2 title: string
3 host: string
4 topic?: string
5}
6
7export type ChannelView = {
8 $type?: string
9 uri: string
10 host: string
11 creator: ProfileView
12 title: string
13 topic?: string
14 connectedCount?: number
15 createdAt?: string
16}
17
18export type ProfileView = {
19 $type?: string
20 did: string
21 handle: string
22 displayName?: string
23 status?: string
24 color?: number
25 avatar?: string
26}
27
28export type Item = Message | Media | Enby
29
30export type Enby = {
31 type: 'enby'
32 id: number
33 lrcdata: LrcBaseItem
34 signetView?: SignetView
35}
36
37export type Message = {
38 type: 'message'
39 id: number
40 lrcdata: LrcMessage
41 messageView?: MessageView
42 signetView?: SignetView
43}
44
45export type Media = Image
46
47export type Image = {
48 type: 'image'
49 id: number
50 lrcdata: LrcMedia
51 mediaView?: MediaView
52 signetView?: SignetView
53}
54
55export type LrcMessage = LrcBaseItem & {
56 body: string
57 pub?: LrcMessagePub
58}
59
60export type LrcMedia = LrcBaseItem & {
61 pub?: LrcMediaPub
62}
63
64export type LrcBaseItem = {
65 mine: boolean
66 muted: boolean
67 init?: LrcInit
68}
69
70export type LrcInit = {
71 color?: number
72 nick?: string
73 handle?: string
74 nonce?: Uint8Array
75}
76
77export type LrcMediaPub = {
78 alt: string
79 contentAddress?: string
80}
81
82export type LrcMessagePub = boolean
83
84export type AspectRatio = {
85 width: number
86 height: number
87}
88
89export function isEnby(item: Item): item is Enby {
90 return item.type === "enby"
91}
92
93export function isMessage(item: Item): item is Message {
94 return item.type === 'message' || item.type === 'enby'
95}
96
97export function isImage(item: Item): item is Image {
98 return item.type === 'image' || item.type === 'enby'
99}
100
101export function isMedia(item: Item): item is Media {
102 return isImage(item)
103}
104
105export type AtpBlob = {
106 $type: string
107 ref: {
108 $link: string
109 }
110 mimeType: string
111 size: number
112}
113
114export type AtpImage = {
115 $type: string
116 alt: string
117 aspectRatio?: ATPAspectRatio
118 blob?: AtpBlob
119}
120
121export type ATPAspectRatio = {
122 width: number
123 height: number
124}
125
126export type LogItem = {
127 id: number
128 binary: string
129 time: number
130 type: string
131 key: number
132}
133
134export type SignetView = {
135 $type?: string
136 uri: string
137 issuer: string
138 channelURI: string
139 lrcId: number
140 author: string
141 authorHandle?: string
142 startedAt: string
143}
144
145export type MessageView = {
146 $type?: string
147 uri: string
148 author: ProfileView
149 body: string
150 nick?: string
151 color?: number
152 signetURI: string
153 postedAt: string
154}
155
156export type MediaView = {
157 $type?: string
158 uri: string
159 author: ProfileView
160 imageView?: ImageView
161 nick?: string
162 color?: number
163 signetURI: string
164 postedAt: string
165}
166
167export type ItemView = MessageView | MediaView
168
169export type ImageView = {
170 $type?: string
171 alt: string
172 src?: string
173 aspectRatio?: AspectRatio
174}
175
176export type SignedItemView = SignedMessageView | SignedMediaView
177
178export type SignedMessageView = {
179 type: 'message'
180 $type?: string
181 uri: string
182 author: ProfileView
183 body: string
184 nick?: string
185 color?: number
186 signet: SignetView
187 postedAt: string
188}
189
190export type SignedMediaView = SignedImageView
191
192export type SignedImageView = {
193 type: 'image'
194 $type?: string
195 uri: string
196 author: ProfileView
197 imageView: ImageView
198 nick?: string
199 color?: number
200 signet: SignetView
201 postedAt: string
202}