handle following and pinning feeds, acocunt createdAt
This commit is contained in:
@@ -88,7 +88,12 @@ export const schema = z.object({
|
||||
disableHaptics: z.boolean().optional(),
|
||||
disableAutoplay: z.boolean().optional(),
|
||||
kawaii: z.boolean().optional(),
|
||||
starterPackId: z.string().optional(),
|
||||
usedStarterPack: z
|
||||
.object({
|
||||
uri: z.string(),
|
||||
cid: z.string(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
export type Schema = z.infer<typeof schema>
|
||||
|
||||
@@ -127,5 +132,5 @@ export const defaults: Schema = {
|
||||
disableHaptics: false,
|
||||
disableAutoplay: prefersReducedMotion,
|
||||
kawaii: false,
|
||||
starterPackId: undefined,
|
||||
usedStarterPack: undefined,
|
||||
}
|
||||
|
||||
@@ -2,23 +2,23 @@ import React from 'react'
|
||||
|
||||
import * as persisted from '#/state/persisted'
|
||||
|
||||
type StateContext = string | undefined
|
||||
type SetContext = (v: string) => void
|
||||
type StateContext = {uri: string; cid: string} | undefined
|
||||
type SetContext = (v: StateContext) => void
|
||||
|
||||
const stateContext = React.createContext<StateContext>(undefined)
|
||||
const setContext = React.createContext<SetContext>((_: string) => {})
|
||||
const setContext = React.createContext<SetContext>((_: StateContext) => {})
|
||||
|
||||
export function Provider({children}: {children: React.ReactNode}) {
|
||||
const [state, setState] = React.useState<string>()
|
||||
const [state, setState] = React.useState<StateContext>()
|
||||
|
||||
const setStateWrapped = (v: string) => {
|
||||
const setStateWrapped = (v: StateContext) => {
|
||||
setState(v)
|
||||
persisted.write('starterPackId', v)
|
||||
persisted.write('usedStarterPack', v)
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
return persisted.onUpdate(() => {
|
||||
setState(persisted.get('starterPackId'))
|
||||
setState(persisted.get('usedStarterPack'))
|
||||
})
|
||||
}, [])
|
||||
|
||||
@@ -31,5 +31,5 @@ export function Provider({children}: {children: React.ReactNode}) {
|
||||
)
|
||||
}
|
||||
|
||||
export const useStarterPack = () => React.useContext(stateContext)
|
||||
export const useSetStarterPack = () => React.useContext(setContext)
|
||||
export const useUsedStarterPack = () => React.useContext(stateContext)
|
||||
export const useSetUsedStarterPack = () => React.useContext(setContext)
|
||||
|
||||
@@ -173,7 +173,7 @@ export function useFeedSourceInfoQuery({uri}: {uri: string}) {
|
||||
|
||||
export const useGetPopularFeedsQueryKey = ['getPopularFeeds']
|
||||
|
||||
export function useGetPopularFeedsQuery({limit = 10}: {limit?: number}) {
|
||||
export function useGetPopularFeedsQuery(limit: number = 10) {
|
||||
const agent = useAgent()
|
||||
return useInfiniteQuery<
|
||||
AppBskyUnspeccedGetPopularFeedGenerators.OutputSchema,
|
||||
|
||||
Reference in New Issue
Block a user