|
|
@ -3,19 +3,34 @@ import { QueryLeafElem, QueryLeafBy, QueryLeafOp, QueryElem } from '../../lib/Qu |
|
|
|
import { Chip, Typography } from '@material-ui/core'; |
|
|
|
import { Chip, Typography } from '@material-ui/core'; |
|
|
|
import { QBQueryPlaceholder } from './QBQueryPlaceholder'; |
|
|
|
import { QBQueryPlaceholder } from './QBQueryPlaceholder'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface ElemChipProps { |
|
|
|
|
|
|
|
label: any |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function LabeledElemChip(props: ElemChipProps) { |
|
|
|
|
|
|
|
const label = <Typography>{props.label}</Typography> |
|
|
|
|
|
|
|
return <Chip label={label} /> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface LeafProps { |
|
|
|
export interface LeafProps { |
|
|
|
elem: QueryLeafElem |
|
|
|
elem: QueryLeafElem |
|
|
|
onReplace: (q: QueryElem) => void |
|
|
|
onReplace: (q: QueryElem) => void |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function QBQueryElemArtistEquals(props: LeafProps) { |
|
|
|
export function QBQueryElemArtistEquals(props: LeafProps) { |
|
|
|
let e = props.elem; |
|
|
|
return <LabeledElemChip label={"By " + props.elem.b}/> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const label = <Typography> |
|
|
|
export function QBQueryElemArtistLike(props: LeafProps) { |
|
|
|
By {e.b} |
|
|
|
return <LabeledElemChip label={"Artist like \"" + props.elem.b + "\""}/> |
|
|
|
</Typography>; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return <Chip label={label} /> |
|
|
|
export function QBQueryElemTitleEquals(props: LeafProps) { |
|
|
|
|
|
|
|
return <LabeledElemChip label={"\"" + props.elem.b + "\""}/> |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function QBQueryElemTitleLike(props: LeafProps) { |
|
|
|
|
|
|
|
return <LabeledElemChip label={"Title like \"" + props.elem.b + "\""}/> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function QBQueryLeafElem(props: LeafProps) { |
|
|
|
export function QBQueryLeafElem(props: LeafProps) { |
|
|
@ -25,6 +40,18 @@ export function QBQueryLeafElem(props: LeafProps) { |
|
|
|
e.leafOp == QueryLeafOp.Equals && |
|
|
|
e.leafOp == QueryLeafOp.Equals && |
|
|
|
typeof e.b == "string") { |
|
|
|
typeof e.b == "string") { |
|
|
|
return <QBQueryElemArtistEquals {...props} /> |
|
|
|
return <QBQueryElemArtistEquals {...props} /> |
|
|
|
|
|
|
|
} else if (e.a == QueryLeafBy.ArtistName && |
|
|
|
|
|
|
|
e.leafOp == QueryLeafOp.Like && |
|
|
|
|
|
|
|
typeof e.b == "string") { |
|
|
|
|
|
|
|
return <QBQueryElemArtistLike {...props} /> |
|
|
|
|
|
|
|
} if (e.a == QueryLeafBy.SongTitle && |
|
|
|
|
|
|
|
e.leafOp == QueryLeafOp.Equals && |
|
|
|
|
|
|
|
typeof e.b == "string") { |
|
|
|
|
|
|
|
return <QBQueryElemTitleEquals {...props} /> |
|
|
|
|
|
|
|
} else if (e.a == QueryLeafBy.SongTitle && |
|
|
|
|
|
|
|
e.leafOp == QueryLeafOp.Like && |
|
|
|
|
|
|
|
typeof e.b == "string") { |
|
|
|
|
|
|
|
return <QBQueryElemTitleLike {...props} /> |
|
|
|
} else if (e.leafOp == QueryLeafOp.Placeholder) { |
|
|
|
} else if (e.leafOp == QueryLeafOp.Placeholder) { |
|
|
|
return <QBQueryPlaceholder |
|
|
|
return <QBQueryPlaceholder |
|
|
|
onReplace={props.onReplace} |
|
|
|
onReplace={props.onReplace} |
|
|
|