parent
b6e937675a
commit
80f35e031b
7 changed files with 170 additions and 40 deletions
@ -0,0 +1,37 @@ |
||||
import React from 'react'; |
||||
import { WindowType } from '../windows/Windows'; |
||||
import { Menu, MenuItem } from '@material-ui/core'; |
||||
|
||||
export interface NewTabProps { |
||||
title: string, |
||||
windowType: WindowType, |
||||
} |
||||
|
||||
export interface IProps { |
||||
anchorEl: null | HTMLElement, |
||||
onClose: () => void, |
||||
onCreateTab: (q: NewTabProps) => void, |
||||
} |
||||
|
||||
export default function AddTabMenu(props: IProps) { |
||||
return <Menu |
||||
anchorEl={props.anchorEl} |
||||
keepMounted |
||||
open={Boolean(props.anchorEl)} |
||||
onClose={props.onClose} |
||||
> |
||||
<MenuItem disabled={true}>New Tab</MenuItem> |
||||
{([ |
||||
WindowType.Query, |
||||
WindowType.EditArtist |
||||
]).map((v: WindowType) => <MenuItem |
||||
onClick={() => { |
||||
props.onClose(); |
||||
props.onCreateTab({ |
||||
title: v, |
||||
windowType: v, |
||||
}) |
||||
}} |
||||
>{v}</MenuItem>)} |
||||
</Menu> |
||||
} |
@ -0,0 +1,29 @@ |
||||
import React from 'react'; |
||||
import { Box } from '@material-ui/core'; |
||||
|
||||
export interface EditArtistWindowState { |
||||
|
||||
} |
||||
|
||||
export enum EditArtistWindowStateActions { |
||||
} |
||||
|
||||
export function EditArtistWindowReducer(state: EditArtistWindowState, action: any) { |
||||
return state; |
||||
} |
||||
|
||||
export interface IProps { |
||||
state: EditArtistWindowState, |
||||
dispatch: (action: any) => void |
||||
} |
||||
|
||||
export default function EditArtistWindow(props: IProps) { |
||||
return <Box width="100%" justifyContent="center" display="flex" flexWrap="wrap"> |
||||
<Box |
||||
m={1} |
||||
width="80%" |
||||
> |
||||
Hello! |
||||
</Box> |
||||
</Box> |
||||
} |
@ -0,0 +1,27 @@ |
||||
import { QueryWindowReducer, QueryWindowState } from "./QueryWindow"; |
||||
import { EditArtistWindowReducer, EditArtistWindowState } from "./EditArtistWindow"; |
||||
|
||||
export enum WindowType { |
||||
Query = "Query", |
||||
EditArtist = "EditArtist", |
||||
} |
||||
|
||||
export type WindowState = QueryWindowState | EditArtistWindowState; |
||||
|
||||
export const newWindowReducer = { |
||||
[WindowType.Query]: QueryWindowReducer, |
||||
[WindowType.EditArtist]: EditArtistWindowReducer, |
||||
} |
||||
|
||||
export const newWindowState = { |
||||
[WindowType.Query]: () => { |
||||
return { |
||||
editingQuery: false, |
||||
query: null, |
||||
resultsForQuery: null, |
||||
}; |
||||
}, |
||||
[WindowType.EditArtist]: () => { |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue