feat: added share secret to main page side nav

This commit is contained in:
Sheen Capadngan
2024-06-26 00:22:47 +08:00
parent fa392382da
commit 663be06d30
2 changed files with 17 additions and 3 deletions
@@ -7,6 +7,7 @@ import {
faCircleDot, faCircleDot,
faClock, faClock,
faPlus, faPlus,
faShare,
faTag faTag
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
@@ -57,6 +58,7 @@ type Props = {
) => Promise<void>; ) => Promise<void>;
tags: WsTag[]; tags: WsTag[];
onCreateTag: () => void; onCreateTag: () => void;
handleSecretShare: (value: string) => void;
}; };
export const SecretDetailSidebar = ({ export const SecretDetailSidebar = ({
@@ -69,7 +71,8 @@ export const SecretDetailSidebar = ({
tags, tags,
onCreateTag, onCreateTag,
environment, environment,
secretPath secretPath,
handleSecretShare
}: Props) => { }: Props) => {
const { const {
register, register,
@@ -381,7 +384,7 @@ export const SecretDetailSidebar = ({
rows={5} rows={5}
/> />
</FormControl> </FormControl>
<div className="my-2 mb-6 border-b border-mineshaft-600 pb-4"> <div className="my-2 mb-4 border-b border-mineshaft-600 pb-4">
<Controller <Controller
control={control} control={control}
name="skipMultilineEncoding" name="skipMultilineEncoding"
@@ -412,7 +415,17 @@ export const SecretDetailSidebar = ({
)} )}
/> />
</div> </div>
<div className="dark mb-4 flex-grow text-sm text-bunker-300"> <div className="ml-1 flex items-center space-x-2">
<Button
className="px-2 py-1"
variant="outline_bg"
leftIcon={<FontAwesomeIcon icon={faShare} />}
onClick={() => handleSecretShare(secret.valueOverride ?? secret.value)}
>
Share Secret
</Button>
</div>
<div className="dark mt-4 mb-4 flex-grow text-sm text-bunker-300">
<div className="mb-2">Version History</div> <div className="mb-2">Version History</div>
<div className="flex h-48 flex-col space-y-2 overflow-y-auto overflow-x-hidden rounded-md border border-mineshaft-600 bg-bunker-800 p-2 dark:[color-scheme:dark]"> <div className="flex h-48 flex-col space-y-2 overflow-y-auto overflow-x-hidden rounded-md border border-mineshaft-600 bg-bunker-800 p-2 dark:[color-scheme:dark]">
{secretVersion?.map(({ createdAt, value, id }, i) => ( {secretVersion?.map(({ createdAt, value, id }, i) => (
@@ -398,6 +398,7 @@ export const SecretListView = ({
onSaveSecret={handleSaveSecret} onSaveSecret={handleSaveSecret}
tags={wsTags} tags={wsTags}
onCreateTag={() => handlePopUpOpen("createTag")} onCreateTag={() => handlePopUpOpen("createTag")}
handleSecretShare={(value: string) => handlePopUpOpen("createSharedSecret", { value })}
/> />
<CreateTagModal <CreateTagModal
isOpen={popUp.createTag.isOpen} isOpen={popUp.createTag.isOpen}