diff --git a/client/src/components/windows/ManageTagsWindow.tsx b/client/src/components/windows/ManageTagsWindow.tsx
index 2250992..f14498c 100644
--- a/client/src/components/windows/ManageTagsWindow.tsx
+++ b/client/src/components/windows/ManageTagsWindow.tsx
@@ -1,11 +1,29 @@
-import React, { useEffect } from 'react';
+import React, { useEffect, useState } from 'react';
import { WindowState } from './Windows';
-import { Box, Typography, Chip } from '@material-ui/core';
+import { Box, Typography, Chip, IconButton } from '@material-ui/core';
import * as serverApi from '../../api';
import LoyaltyIcon from '@material-ui/icons/Loyalty';
+import ArrowRightIcon from '@material-ui/icons/ArrowRight';
+import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
var _ = require('lodash');
+export enum TagChangeType {
+ Delete = "Delete",
+ Create = "Create",
+ MoveTo = "MoveTo",
+ MergeTo = "MergeTo",
+ Rename = "Rename",
+}
+
+export interface TagChange {
+ type: TagChangeType,
+ parent?: number | string, // Number if MuDBase ID, string if UUID for new tag not in DB yet.
+ name?: string,
+}
+
export interface ManageTagsWindowState extends WindowState {
+ fetchedTags: any[],
+ pendingChanges: TagChange[],
}
export enum ManageTagsWindowActions {
@@ -61,19 +79,43 @@ export async function getAllTags() {
})();
}
-export function SingleTag(props: any) {
+export function SingleTag(props: {
+ tag: any,
+ prependElems: any[],
+}) {
const tag = props.tag;
- const thisTag = ;
+ const hasChildren = 'children' in tag && tag.children.length > 0;
+
+ const [expanded, setExpanded] = useState(false);
+
+ const expandArrow = expanded ?
+ setExpanded(false)}> :
+ setExpanded(true)}>;
+
+ const GreyedTag = (props: any) =>
+
+ ;
return <>
- {thisTag}
- {tag.children && tag.children.map((tag: any) => {
- return
- {thisTag}
- /
-
+
+
+ {expandArrow}
- })}
+ {props.prependElems}
+
+
+ {hasChildren && expanded && tag.children.map((child: any) => ,
+ /]}
+ />)}
>
}
@@ -115,10 +157,10 @@ export default function ManageTagsWindow(props: IProps) {
mt={4}
width="80%"
>
- {tags && tags.length && tags.map((tag: any) => {
- console.log("Tags:", tags);
- return ;
- })}
+ {tags && tags.length && tags.map((tag: any) => {
+ console.log("Tags:", tags);
+ return ;
+ })}
}
\ No newline at end of file