-
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 (#2798)
<!-- PR title: GRW-123 / Feature / Awesome new thing --> ## Describe your changes ![Screenshot 2023-07-17 at 15.42.18.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/OgXegTwxM9IeuXHZyw5h/797222ff-4656-4c87-a16c-a271a0605b8a/Screenshot%202023-07-17%20at%2015.42.18.png) - Add button (link) to reset current session from Debug Dialog - Include alongside shop session ID <!-- What changes are made? If there are many changes, a list might be a good format. If it makes sense, add screenshots and/or screen recordings here. --> ## Justify why they are needed - One of the common operations ## Checklist before requesting a review - [ ] I have performed a self-review of my code
- Loading branch information
1 parent
558408b
commit af5417c
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