mirror of
https://github.com/joinmarket-webui/jam.git
synced 2026-08-20 13:28:21 +02:00
chore: initially display cheatsheet
This commit is contained in:
parent
808d595bef
commit
ddafccca17
3 changed files with 17 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ import { Dialog, DialogContent, DialogFooter } from '@/components/ui/dialog'
|
|||
import { Cheatsheet } from '@/components/ui/jam/Cheatsheet'
|
||||
import { useJmInfo } from '@/hooks/useJmInfo'
|
||||
import { toSemVer } from '@/lib/utils'
|
||||
import { jamSettingsStore } from '@/store/jamSettingsStore'
|
||||
import { jmSessionStore } from '@/store/jmSessionStore'
|
||||
import packageInfo from '../../../package.json'
|
||||
|
||||
|
|
@ -45,11 +46,19 @@ const BetaWarningModal = ({ open, onOpenChange }: { open: boolean; onOpenChange:
|
|||
|
||||
export function AppFooter() {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const blockHeight = useStore(jmSessionStore, (state) => state.state?.block_height)
|
||||
const [isCheatsheetOpen, setIsCheatsheetOpen] = useState(false)
|
||||
const [isShowBetaWarning, setShowBetaWarning] = useState(false)
|
||||
const [isOrderbookOverlayOpen, setIsOrderbookOverlayOpen] = useState(false)
|
||||
|
||||
const cheatsheetLastDisplayTime = useStore(jamSettingsStore, (state) => state.state.cheatsheetLastDisplayTime)
|
||||
const [isCheatsheetOpen, setIsCheatsheetOpen] = useState(!cheatsheetLastDisplayTime)
|
||||
|
||||
const handleCloseCheatsheet = () => {
|
||||
jamSettingsStore.getState().update({ cheatsheetLastDisplayTime: Date.now() })
|
||||
setIsCheatsheetOpen(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<footer className="flex items-center justify-between gap-2 p-4">
|
||||
|
|
@ -92,7 +101,7 @@ export function AppFooter() {
|
|||
</div>
|
||||
</footer>
|
||||
|
||||
{isCheatsheetOpen && <Cheatsheet setIsCheatsheetOpen={setIsCheatsheetOpen} />}
|
||||
{isCheatsheetOpen && <Cheatsheet onClose={handleCloseCheatsheet} />}
|
||||
<OrderbookOverlay open={isOrderbookOverlayOpen} onOpenChange={setIsOrderbookOverlayOpen} />
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@ import PageTitle from '@/components/ui/jam/PageTitle'
|
|||
import { routes } from '@/constants/routes'
|
||||
|
||||
interface CheatsheetProps {
|
||||
setIsCheatsheetOpen: (value: boolean) => void
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
export const Cheatsheet = ({ setIsCheatsheetOpen }: CheatsheetProps) => {
|
||||
export const Cheatsheet = ({ onClose }: CheatsheetProps) => {
|
||||
const { t } = useTranslation()
|
||||
const [isAnimating, setIsAnimating] = useState(false)
|
||||
|
||||
const handleClose = () => {
|
||||
setIsAnimating(true)
|
||||
setTimeout(() => {
|
||||
setIsCheatsheetOpen(false)
|
||||
onClose()
|
||||
setIsAnimating(false)
|
||||
}, 333)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import { createStore } from 'zustand'
|
||||
import { persist, createJSONStorage } from 'zustand/middleware'
|
||||
import { isDevMode } from '@/constants/debugFeatures'
|
||||
import type { Currency } from '@/types/global'
|
||||
import type { Currency, Milliseconds } from '@/types/global'
|
||||
|
||||
export type JamSettings = {
|
||||
developerMode: boolean
|
||||
privateMode: boolean
|
||||
currencyUnit: Currency
|
||||
cheatsheetLastDisplayTime: Milliseconds | undefined
|
||||
}
|
||||
|
||||
interface JamSettingsStoreState {
|
||||
|
|
@ -19,6 +20,7 @@ const initial: JamSettings = {
|
|||
developerMode: isDevMode(),
|
||||
privateMode: false,
|
||||
currencyUnit: 'sats',
|
||||
cheatsheetLastDisplayTime: undefined,
|
||||
}
|
||||
|
||||
export const jamSettingsStore = createStore<JamSettingsStoreState>()(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue