-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reset sesion button to debug dialog
- Loading branch information
1 parent
2b76d25
commit 8290419
Showing
7 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 26 additions & 7 deletions
33
apps/store/src/components/DebugDialog/DebugShopSessionSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
import { Space, Text } from 'ui' | ||
import styled from '@emotion/styled' | ||
import { useRouter } from 'next/router' | ||
import { Button, Space, Text, theme } from 'ui' | ||
import { useShopSession } from '@/services/shopSession/ShopSessionContext' | ||
import { PageLink } from '@/utils/PageLink' | ||
import { CopyToClipboard } from './CopyToClipboard' | ||
|
||
export const DebugShopSessionSection = () => { | ||
const { shopSession } = useShopSession() | ||
const router = useRouter() | ||
|
||
if (!shopSession) return null | ||
|
||
const nextUrl = `/${router.locale}${router.pathname}` | ||
|
||
return ( | ||
<Space y={0.25}> | ||
<Text as="p" size="sm"> | ||
Shop Session | ||
</Text> | ||
<CopyToClipboard>{shopSession.id}</CopyToClipboard> | ||
</Space> | ||
<Layout> | ||
<Space y={0.25} style={{ flex: 1 }}> | ||
<Text as="p" size="sm"> | ||
Shop Session | ||
</Text> | ||
<CopyToClipboard>{shopSession.id}</CopyToClipboard> | ||
</Space> | ||
|
||
<Button variant="secondary" size="medium" href={PageLink.apiSessionReset({ next: nextUrl })}> | ||
Reset | ||
</Button> | ||
</Layout> | ||
) | ||
} | ||
|
||
const Layout = styled.div({ | ||
display: 'grid', | ||
gridTemplateColumns: '4fr 1fr', | ||
alignItems: 'flex-end', | ||
gap: theme.space.xs, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters