diff --git a/client/src/components/windows/song/SongWindow.tsx b/client/src/components/windows/song/SongWindow.tsx
index c0f9e93..7cf86ac 100644
--- a/client/src/components/windows/song/SongWindow.tsx
+++ b/client/src/components/windows/song/SongWindow.tsx
@@ -16,17 +16,14 @@ import { querySongs } from '../../../lib/backend/queries';
import { useParams } from 'react-router';
export type SongMetadata = serverApi.SongDetails;
-export type SongMetadataChanges = serverApi.ModifySongRequest;
export interface SongWindowState extends WindowState {
id: number,
metadata: SongMetadata | null,
- pendingChanges: SongMetadataChanges | null,
}
export enum SongWindowStateActions {
SetMetadata = "SetMetadata",
- SetPendingChanges = "SetPendingChanges",
Reload = "Reload",
}
@@ -34,8 +31,6 @@ export function SongWindowReducer(state: SongWindowState, action: any) {
switch (action.type) {
case SongWindowStateActions.SetMetadata:
return { ...state, metadata: action.value }
- case SongWindowStateActions.SetPendingChanges:
- return { ...state, pendingChanges: action.value }
case SongWindowStateActions.Reload:
return { ...state, metadata: null, pendingChanges: null }
default:
@@ -60,7 +55,6 @@ export default function SongWindow(props: {}) {
const [state, dispatch] = useReducer(SongWindowReducer, {
id: id,
metadata: null,
- pendingChanges: null,
});
return
@@ -70,7 +64,7 @@ export function SongWindowControlled(props: {
state: SongWindowState,
dispatch: (action: any) => void,
}) {
- let { pendingChanges, metadata, id: songId } = props.state;
+ let { metadata, id: songId } = props.state;
let { dispatch } = props;
useEffect(() => {
@@ -83,23 +77,7 @@ export function SongWindowControlled(props: {
})
}, [songId, dispatch]);
- const [editingTitle, setEditingTitle] = useState(null);
- const title = setEditingTitle(v)}
- onChangeChangedValue={(v: string | null) => {
- let newVal: any = { ...pendingChanges };
- if (v) { newVal.title = v }
- else { delete newVal.title }
- props.dispatch({
- type: SongWindowStateActions.SetPendingChanges,
- value: newVal,
- })
- }}
- />
+ const title = {metadata?.title || "(Unknown title)"}
const artists = metadata?.artists && metadata?.artists.map((artist: ArtistMetadata) => {
return
@@ -126,22 +104,6 @@ export function SongWindowControlled(props: {
});
- const [applying, setApplying] = useState(false);
- const maybeSubmitButton = pendingChanges && Object.keys(pendingChanges).length > 0 &&
-
- {
- setApplying(true);
- saveSongChanges(props.state.id, pendingChanges || {})
- .then(() => {
- setApplying(false);
- props.dispatch({
- type: SongWindowStateActions.Reload
- })
- })
- }} />
- {applying && }
-
-
return
}
-
- {maybeSubmitButton}
-
}
\ No newline at end of file