-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
356-github-sync-plugin-losing-access-tokens-sometimes #1373
Closed
swordEdge
wants to merge
9
commits into
main
from
356-github-sync-plugin-losing-access-tokens-sometimes
Closed
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9b76017
1266 add border token type (#1341)
swordEdge df957b1
Test/remap tokens (#1356)
swordEdge 7b5d605
Merge remote-tracking branch 'origin/release-123' into next
six7 05d8a20
Merge remote-tracking branch 'origin/release-123' into next
six7 35e50a5
fix dependencies for isActive
robinhoodie0823 fe7fb37
remove delete buttnn when storage item is active
robinhoodie0823 0b364b2
fix isSameCredential
robinhoodie0823 2d6ab63
fix if condition
robinhoodie0823 f4a229b
undo isActive check
six7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from 'react'; | ||
import { ResolveTokenValuesResult } from '@/plugin/tokenHelpers'; | ||
import DownshiftInput from './DownshiftInput'; | ||
import { getLabelForProperty } from '@/utils/getLabelForProperty'; | ||
|
||
const mapTypeToPlaceHolder = { | ||
color: 'Border color', | ||
width: 'Border width', | ||
style: 'solid | dashed', | ||
}; | ||
|
||
export default function BorderTokenDownShiftInput({ | ||
name, | ||
value, | ||
type, | ||
resolvedTokens, | ||
handleChange, | ||
setInputValue, | ||
handleToggleInputHelper, | ||
}: { | ||
name: string, | ||
value: string; | ||
type: string; | ||
resolvedTokens: ResolveTokenValuesResult[]; | ||
handleChange: React.ChangeEventHandler; | ||
setInputValue: (newInputValue: string, property: string) => void; | ||
handleToggleInputHelper?: () => void; | ||
}) { | ||
const onChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => handleChange(e), [handleChange]); | ||
const handleBorderDownShiftInputChange = React.useCallback((newInputValue: string) => setInputValue(newInputValue, name), [name, setInputValue]); | ||
const getIconComponent = React.useMemo(() => getLabelForProperty(name), [name]); | ||
return ( | ||
<DownshiftInput | ||
name={name} | ||
value={value} | ||
type={type} | ||
label={getIconComponent} | ||
inlineLabel | ||
resolvedTokens={resolvedTokens} | ||
handleChange={onChange} | ||
setInputValue={handleBorderDownShiftInputChange} | ||
placeholder={mapTypeToPlaceHolder[name as keyof typeof mapTypeToPlaceHolder]} | ||
prefix={ | ||
name === 'color' && ( | ||
<button | ||
type="button" | ||
className="block w-4 h-4 rounded-sm cursor-pointer shadow-border shadow-gray-300 focus:shadow-focus focus:shadow-primary-400" | ||
style={{ background: value ?? '#000000', fontSize: 0 }} | ||
onClick={handleToggleInputHelper} | ||
> | ||
{value} | ||
</button> | ||
) | ||
} | ||
suffix | ||
/> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import { useUIDSeed } from 'react-uid'; | ||
import get from 'just-safe-get'; | ||
import { EditTokenObject } from '@/types/tokens'; | ||
import Heading from './Heading'; | ||
import { TokenTypes } from '@/constants/TokenTypes'; | ||
import { ResolveTokenValuesResult } from '@/plugin/tokenHelpers'; | ||
import Stack from './Stack'; | ||
import BorderTokenDownShiftInput from './BorderTokenDownShiftInput'; | ||
import ColorPicker from './ColorPicker'; | ||
|
||
const propertyTypes = { | ||
color: TokenTypes.COLOR, | ||
width: TokenTypes.BORDER_WIDTH, | ||
style: 'strokeStyle', | ||
}; | ||
|
||
export default function BorderTokenForm({ | ||
internalEditToken, | ||
resolvedTokens, | ||
handleBorderValueChange, | ||
handleBorderValueDownShiftInputChange, | ||
}: { | ||
internalEditToken: Extract<EditTokenObject, { type: TokenTypes.BORDER }>; | ||
resolvedTokens: ResolveTokenValuesResult[]; | ||
handleBorderValueChange: React.ChangeEventHandler; | ||
handleBorderValueDownShiftInputChange: (newInputValue: string, property: string) => void; | ||
}) { | ||
const seed = useUIDSeed(); | ||
const [inputHelperOpen, setInputHelperOpen] = React.useState<boolean>(false); | ||
|
||
const handleToggleInputHelper = React.useCallback(() => setInputHelperOpen(!inputHelperOpen), [inputHelperOpen]); | ||
const onColorChange = React.useCallback((color: string) => { | ||
handleBorderValueDownShiftInputChange(color, 'color'); | ||
}, [handleBorderValueChange]); | ||
|
||
return ( | ||
<Stack direction="column" gap={2}> | ||
<Stack direction="row" gap={2} justify="between" align="center"> | ||
<Heading>Value</Heading> | ||
</Stack> | ||
<Stack gap={2} direction="column"> | ||
{Object.entries(internalEditToken.schema.schemas.value.properties ?? {}).map(([key], keyIndex) => ( | ||
<> | ||
<BorderTokenDownShiftInput | ||
name={key} | ||
key={`border-input-${seed(keyIndex)}`} | ||
value={typeof internalEditToken.value === 'object' ? get(internalEditToken.value, key, '') : ''} | ||
type={propertyTypes[key as keyof typeof propertyTypes]} | ||
resolvedTokens={resolvedTokens} | ||
handleChange={handleBorderValueChange} | ||
setInputValue={handleBorderValueDownShiftInputChange} | ||
handleToggleInputHelper={handleToggleInputHelper} | ||
/> | ||
{inputHelperOpen && key === 'color' && ( | ||
<ColorPicker value={typeof internalEditToken.value === 'object' && get(internalEditToken.value, key, '')} onChange={onColorChange} /> | ||
)} | ||
</> | ||
))} | ||
|
||
</Stack> | ||
</Stack> | ||
); | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/app/components/TokenTooltip/SingleBorderValueDisplay.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { TokenBorderValue } from '@/types/values'; | ||
import TooltipProperty from './TooltipProperty'; | ||
import Stack from '../Stack'; | ||
|
||
type Props = { | ||
value: TokenBorderValue; | ||
resolvedValue: TokenBorderValue; | ||
}; | ||
|
||
export const SingleBorderValueDisplay: React.FC<Props> = ({ value, resolvedValue }) => ( | ||
<Stack direction="column" align="start" gap={1}> | ||
<TooltipProperty label="Color" value={value.color} resolvedValue={resolvedValue?.color} /> | ||
<TooltipProperty label="Width" value={value.width} resolvedValue={resolvedValue?.width} /> | ||
<TooltipProperty label="Style" value={value.style} resolvedValue={resolvedValue?.style} /> | ||
</Stack> | ||
); |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you revert this now that we know this didn't cause it? so the Delete button is visible when it's active even.