Skip to content

Commit

Permalink
fix: stored user profile item style
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 4, 2024
1 parent ca381ce commit 64f40ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderer/src/hooks/biz/useDailyTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const useDailyTask = () => {
const today = new Date().toDateString()

if (localStorage.getItem(CLAIM_DAILY_KEY) === today) return
claimDaily().finally(() => {
claimDaily().then(() => {
localStorage.setItem(CLAIM_DAILY_KEY, today)
})
}, [claimDaily])
Expand Down
13 changes: 12 additions & 1 deletion src/renderer/src/modules/profile/user-profile-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,29 @@ import { useAuthQuery } from "@renderer/hooks/common"
import { apiClient } from "@renderer/lib/api-fetch"
import { defineQuery } from "@renderer/lib/defineQuery"
import { nextFrame, stopPropagation } from "@renderer/lib/dom"
import { getStorageNS } from "@renderer/lib/ns"
import { cn } from "@renderer/lib/utils"
import type { SubscriptionModel } from "@renderer/models"
import { useUserSubscriptionsQuery } from "@renderer/modules/profile/hooks"
import { useSubscriptionStore } from "@renderer/store/subscription"
import { useUserById } from "@renderer/store/user"
import { useAnimationControls } from "framer-motion"
import { useAtom } from "jotai"
import { atomWithStorage } from "jotai/utils"
import { throttle } from "lodash-es"
import type { FC } from "react"
import { Fragment, useEffect, useMemo, useRef, useState } from "react"

import { FeedForm } from "../discover/feed-form"

const itemVariantAtom = atomWithStorage(
getStorageNS("item-variant"),
"loose",
undefined,
{
getOnInit: true,
},
)
type ItemVariant = "loose" | "compact"
export const UserProfileModalContent: FC<{
userId: string
Expand Down Expand Up @@ -155,7 +166,7 @@ export const UserProfileModalContent: FC<{
}
}, [variant, winHeight])

const [itemStyle, setItemStyle] = useState("loose" as ItemVariant)
const [itemStyle, setItemStyle] = useAtom(itemVariantAtom)

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const UserRenderer = ({

const name = isMe ? "You" : user?.name || APP_NAME

const presentUserModal = usePresentUserProfileModal()
const presentUserModal = usePresentUserProfileModal("drawer")
return (
<MotionButtonBase
onClick={() => {
Expand Down

0 comments on commit 64f40ee

Please sign in to comment.