-
Notifications
You must be signed in to change notification settings - Fork 22
/
feed.ts
54 lines (46 loc) · 1.14 KB
/
feed.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { ComponentType } from 'react'
export type FeedSourceItem<Props extends unknown = any> = {
props: Props
// If pending, the item will count towards the pending count.
pending: boolean
order?: number
}
export type FeedSourceDaoWithItems<Data extends unknown = any> = {
chainId: string
coreAddress: string
items: FeedSourceItem<Data>[]
}
export type FeedSourceData<Data extends unknown = any> = {
loading: boolean
refreshing: boolean
daosWithItems: FeedSourceDaoWithItems<Data>[]
refresh: () => void
}
export type FeedSource<Data extends unknown = any> = {
id: string
Renderer: ComponentType<Data>
useData: () => FeedSourceData<Data>
}
export type FeedItem<Data extends unknown = any> = FeedSourceItem<Data> & {
Renderer: ComponentType<Data>
}
export type FeedDaoWithItems = {
dao: {
chainId: string
coreAddress: string
name: string
imageUrl: string
}
items: FeedItem[]
}
export type FeedState = {
loading: boolean
refreshing: boolean
daosWithItems: FeedDaoWithItems[]
pendingItemCount: number
totalItemCount: number
refresh: () => void
}
export type FeedFilter = {
chainId?: string
}