feat: add community resumables
This commit is contained in:
1 parent
98a597c0d3
commit
47b8b21ede
4 files changed
+33
-14
No files matched your search
@@ -303,7 +303,7 @@
|
||||
<CommandItem
|
||||
{action}
|
||||
class="{globalIndex == selectedIndex
|
||||
? 'bg-slate-200 dark:bg-zinc-800 text-inherit'
|
||||
? '!bg-slate-100 dark:!bg-zinc-800 text-inherit'
|
||||
: 'text-slate-600 dark:text-zinc-400'} block"
|
||||
/>
|
||||
</li>
|
||||
|
||||
+18
-2
@@ -72,7 +72,7 @@ export const isPrivateMessageReport = (
|
||||
|
||||
export interface ResumableItem {
|
||||
url: string
|
||||
id: number
|
||||
id?: number
|
||||
name: string
|
||||
avatar?: string
|
||||
type: 'community' | 'post'
|
||||
@@ -82,7 +82,23 @@ export interface ResumableItem {
|
||||
}
|
||||
}
|
||||
|
||||
export let resumables = writable<ResumableItem[]>([])
|
||||
function resumableStore(limit: number = 10) {
|
||||
const { subscribe, set, update } = writable<ResumableItem[]>([])
|
||||
|
||||
return {
|
||||
subscribe, set, update,
|
||||
add: (item: ResumableItem) => {
|
||||
update(resumables => {
|
||||
if (resumables.find(i => JSON.stringify(i) == JSON.stringify(item))) return resumables
|
||||
resumables.unshift(item)
|
||||
if (resumables.length > limit) resumables.pop()
|
||||
return resumables
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export let resumables = resumableStore()
|
||||
|
||||
export function addFavorite(item: Community, add: boolean = true) {
|
||||
const pd = get(profileData)
|
||||
|
||||
Reference in new issue
Block a user