Skip to content

Commit 419caee

Browse files
authored
feat: fix overlay title when token is cloned vs created (#3617)
* feat: fix title of displayTokenOverlay when token cloned vs created * fix: prettier * fix: added case statement to 'add-note' and 'access-clone-token'
1 parent 25dba7c commit 419caee

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

src/authorizations/components/redesigned/DisplayTokenOverlay.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ type ReduxProps = ConnectedProps<typeof connector>
2525
type Props = ReduxProps
2626

2727
const DisplayTokenOverlay: FC<Props> = props => {
28-
const {onClose} = useContext(OverlayContext)
28+
const {onClose, overlayID} = useContext(OverlayContext)
2929

3030
return (
3131
<Overlay.Container maxWidth={750}>
3232
<Overlay.Header
33-
title="You've successfully created an API token"
33+
title={
34+
overlayID === 'access-token'
35+
? "You've successfully created an API Token"
36+
: "You've successfully cloned an API Token"
37+
}
3438
onDismiss={onClose}
3539
wrapText={true}
3640
/>

src/authorizations/components/redesigned/TokenRow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ class TokensRow extends PureComponent<Props> {
156156
description: incrementCloneName(allTokenDescriptions, description),
157157
})
158158
event('token.clone.success', {id: this.props.auth.id, name: description})
159-
this.props.showOverlay('access-token', null, () => dismissOverlay())
159+
this.props.showOverlay('access-cloned-token', null, () =>
160+
dismissOverlay()
161+
)
160162
} catch {
161163
event('token.clone.failure', {id: this.props.auth.id, name: description})
162164
}

src/overlays/components/OverlayController.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export const OverlayController: FunctionComponent = () => {
6464
useMemo(() => {
6565
switch (overlayID) {
6666
case 'add-note':
67+
activeOverlay.current = <NoteEditorOverlay onClose={onClose} />
68+
break
6769
case 'edit-note':
6870
activeOverlay.current = <NoteEditorOverlay onClose={onClose} />
6971
break
@@ -73,6 +75,9 @@ export const OverlayController: FunctionComponent = () => {
7375
case 'add-custom-token':
7476
activeOverlay.current = <CustomApiTokenOverlay onClose={onClose} />
7577
break
78+
case 'access-cloned-token':
79+
activeOverlay.current = <DisplayTokenOverlay />
80+
break
7681
case 'access-token':
7782
activeOverlay.current = <DisplayTokenOverlay />
7883
break

src/overlays/reducers/overlays.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type OverlayID =
1010
| 'edit-note'
1111
| 'add-master-token'
1212
| 'access-token'
13+
| 'access-cloned-token'
1314
| 'add-custom-token'
1415
| 'add-token'
1516
| 'telegraf-config'

0 commit comments

Comments
 (0)