import React from 'react';
import { QueryLeafElem, QueryLeafBy, QueryLeafOp, QueryElem, TagQueryInfo, isTagQueryInfo } from '../../lib/query/Query';
import { Chip, Typography, IconButton, Box } from '@material-ui/core';
import { QBPlaceholder } from './QBPlaceholder';
import DeleteIcon from '@material-ui/icons/Delete';
import { Requests } from './QueryBuilder';
import stringifyList from '../../lib/stringifyList';
export interface ElemChipProps {
label: any,
extraElements?: any,
}
export function LabeledElemChip(props: ElemChipProps) {
const label =
{props.label}
{props.extraElements}
return
}
export interface LeafProps {
elem: QueryLeafElem,
onReplace: (q: QueryElem) => void,
extraElements?: any,
}
export function QBQueryElemArtistEquals(props: LeafProps) {
return
}
export function QBQueryElemArtistLike(props: LeafProps) {
return
}
export function QBQueryElemTitleEquals(props: LeafProps) {
return
}
export function QBQueryElemTitleLike(props: LeafProps) {
return
}
export function QBQueryElemAlbumEquals(props: LeafProps) {
return
}
export function QBQueryElemAlbumLike(props: LeafProps) {
return
}
export function QBQueryElemTagEquals(props: LeafProps) {
if (!isTagQueryInfo(props.elem.b)) {
throw new Error("Tag equals should have a TagQueryInfo operand");
}
const tagInfo: TagQueryInfo = props.elem.b;
return (idx === 0) ? e : " / " + e) + "\""}
extraElements={props.extraElements}
/>
}
export interface DeleteButtonProps {
onClick?: (e: any) => void,
}
export function QBQueryElemDeleteButton(props: DeleteButtonProps) {
return
}
export interface IProps {
elem: QueryLeafElem,
onReplace: (q: QueryElem | null) => void,
editingQuery: boolean,
requestFunctions: Requests,
}
export function QBLeafElem(props: IProps) {
let e = props.elem;
const extraElements = props.editingQuery ?
props.onReplace(null)}
/>
: undefined;
if (e.a == QueryLeafBy.ArtistName &&
e.leafOp == QueryLeafOp.Equals &&
typeof e.b == "string") {
return
} else if (e.a == QueryLeafBy.ArtistName &&
e.leafOp == QueryLeafOp.Like &&
typeof e.b == "string") {
return
} else if (e.a == QueryLeafBy.AlbumName &&
e.leafOp == QueryLeafOp.Equals &&
typeof e.b == "string") {
return
} else if (e.a == QueryLeafBy.AlbumName &&
e.leafOp == QueryLeafOp.Like &&
typeof e.b == "string") {
return
} if (e.a == QueryLeafBy.SongTitle &&
e.leafOp == QueryLeafOp.Equals &&
typeof e.b == "string") {
return
} else if (e.a == QueryLeafBy.SongTitle &&
e.leafOp == QueryLeafOp.Like &&
typeof e.b == "string") {
return
} else if (e.a == QueryLeafBy.TagInfo &&
e.leafOp == QueryLeafOp.Equals &&
isTagQueryInfo(e.b)) {
return
}else if (e.leafOp == QueryLeafOp.Placeholder) {
return
}
throw new Error("Unsupported leaf element");
}