diff --git a/client/src/components/common/DiscardChangesButton.tsx b/client/src/components/common/DiscardChangesButton.tsx new file mode 100644 index 0000000..0c6e958 --- /dev/null +++ b/client/src/components/common/DiscardChangesButton.tsx @@ -0,0 +1,13 @@ +import React from 'react'; +import { Box, Button } from '@material-ui/core'; + +export default function DiscardChangesButton(props: any) { + return + + +} \ No newline at end of file diff --git a/client/src/components/windows/manage_tags/ManageTagsWindow.tsx b/client/src/components/windows/manage_tags/ManageTagsWindow.tsx index bae7ba5..6dedb7b 100644 --- a/client/src/components/windows/manage_tags/ManageTagsWindow.tsx +++ b/client/src/components/windows/manage_tags/ManageTagsWindow.tsx @@ -273,13 +273,20 @@ export default function ManageTagsWindow(props: IProps) { > Manage Tags - 0 && - - + props.dispatch({ + type: ManageTagsWindowActions.SetPendingChanges, + value: [], + })} + onSave={() => {}} + /> + } ; + const [tag, setTag] = useState(undefined); + const [oldParent, setOldParent] = useState(undefined); + const [newParent, setNewParent] = useState(undefined); + + useEffect(() => { + getTag(props.change.id).then((tag: any) => { + if (tag.parentId) { + getTag(tag.parentId).then((parent: any) => setOldParent(parent)); + } else { + setOldParent(null); + } + setTag(tag); + }) + if (props.change.type === TagChangeType.MoveTo) { + if (props.change.parent) { + getTag(props.change.parent).then((tag: any) => setNewParent(tag)); + } else { + setNewParent(null); + } + } + }, [props.change.id]); + + const MakeTag = (props: { name: string }) => + const MainTag = tag ? + : + ; switch (props.change.type) { case TagChangeType.Delete: - return Delete {tag} + return Delete {MainTag} + case TagChangeType.Rename: + const NewTag = tag ? + : + ; + return Rename {MainTag} to {NewTag} + case TagChangeType.MoveTo: + const OldParent = oldParent !== undefined ? + : + ; + const NewParent = newParent !== undefined ? + : + ; + return Move {MainTag} from {OldParent} to {NewParent} default: throw new Error("Unhandled tag change type") } @@ -32,8 +86,22 @@ export function TagChangeDisplay(props: { export default function ControlTagChanges(props: { changes: TagChange[], + onSave: () => void, + onDiscard: () => void, }) { - return <> - {props.changes.map((change: any) => )} - + return + Pending changes + + {props.changes.map((change: any) => + + + + + )} + + + Save Changes + Discard Changes + + } \ No newline at end of file