parent
e81f61637f
commit
1c098ab224
10 changed files with 259 additions and 348 deletions
@ -0,0 +1,39 @@ |
||||
import React from 'react'; |
||||
import { Typography, Chip } from '@material-ui/core'; |
||||
|
||||
export enum TagChangeType { |
||||
Delete = "Delete", |
||||
Create = "Create", |
||||
MoveTo = "MoveTo", |
||||
MergeTo = "MergeTo", |
||||
Rename = "Rename", |
||||
} |
||||
|
||||
export interface TagChange { |
||||
type: TagChangeType, |
||||
id: number, // MuDBase ID. If not in database yet, negative IDs will be used until submitted.
|
||||
parent?: number | null, // MuDBase ID. If not in database yet, negative IDs will be used until submitted.
|
||||
// null refers to the tags root.
|
||||
name?: string, |
||||
} |
||||
|
||||
export function TagChangeDisplay(props: { |
||||
change: TagChange, |
||||
}) { |
||||
const tag = <Chip size="small" label={props.change.id} />; |
||||
|
||||
switch (props.change.type) { |
||||
case TagChangeType.Delete: |
||||
return <Typography>Delete {tag}</Typography> |
||||
default: |
||||
throw new Error("Unhandled tag change type") |
||||
} |
||||
} |
||||
|
||||
export default function ControlTagChanges(props: { |
||||
changes: TagChange[], |
||||
}) { |
||||
return <> |
||||
{props.changes.map((change: any) => <TagChangeDisplay change={change} />)} |
||||
</> |
||||
} |
Loading…
Reference in new issue