Skip to content

Commit

Permalink
Merge branch 'daniel-schwartz-k:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
danielschwartz85 authored Sep 5, 2023
2 parents 348ccea + d5c1abc commit 31d6dc5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
12 changes: 12 additions & 0 deletions Notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Notes

## Fix me



## Todo

1. add Encrypted secrets option
each secret can have an additional encryption key
add input for encryption key
2. add Verified Invalid text to secret
21 changes: 15 additions & 6 deletions src/components/common/textFieldCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,35 @@ export type ITextFieldCopyProps = Omit<TextFieldProps, 'onChange'> & {

export default function TextFieldCopy(props: ITextFieldCopyProps) {
const { value, error, onChange, ariaLabel, ...rest } = props
const [isHovered, setIsHovered] = useState(false)
const [isActive, setIsActive] = useState(false)

const onFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {
setIsActive(true)
rest.onFocus?.(e)
}
const onBlur = (e: React.FocusEvent<HTMLTextAreaElement>) => {
setIsActive(false)
rest.onBlur?.(e)
}

return (
<TextField
{...rest}
// If we use "DefaultValue" we can't control the TextField
// If we use "value" in the TextField then we loose undo/redo and have a cursor bug.
defaultValue={isHovered ? value : undefined}
value={!isHovered ? value : undefined}
defaultValue={isActive ? value : undefined}
value={!isActive ? value : undefined}
multiline
error={error}
fullWidth={true}
spellCheck={false}
onChange={(e) => onChange(e.target.value)}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
onFocus={onFocus}
onBlur={onBlur}
sx={{ '& textarea.MuiInputBase-inputMultiline': { mr: 5 } }}
inputProps={ariaLabel ? { 'aria-label': ariaLabel } : undefined}
InputProps={{
endAdornment: <CopyButton value={value} visible={!error && isHovered} />,
endAdornment: <CopyButton value={value} visible={!error && isActive} />,
}}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/encoded/encoded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function Encoded(props: IEncodedProps) {
<StyledHeader variant="h4">{'Encoded'}</StyledHeader>
<StyledCard>
<TextFieldCopy
value={value}
value={isAppStart ? '' : value}
placeholder="Paste JWT.."
rows={10}
error={error}
Expand Down
2 changes: 1 addition & 1 deletion src/components/secret/secret.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Secret(props: ISecretProps) {

return (
<>
<StyledHeader variant="h5">{'Secret'}</StyledHeader>
<StyledHeader variant="h5">{'Verify Signature'}</StyledHeader>
<StyledCard>
<Grid container sx={{ justifyContent: 'space-between', alignItems: 'center' }}>
<Grid item md={4} xs={6}>
Expand Down
2 changes: 1 addition & 1 deletion src/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const DefaultState = {
name: 'John Doe',
iat: 1516239022,
}),
secret: 'YOUR SECRET HERE',
secret: 'YOUR-SECRET-HERE',
isVerified: false,
}

Expand Down

0 comments on commit 31d6dc5

Please sign in to comment.