mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-22 17:47:16 +00:00
Simplify open/closed windows
This commit is contained in:
parent
67e1e1f587
commit
781bec6408
1 changed files with 15 additions and 16 deletions
|
|
@ -26,32 +26,31 @@ const App = ({
|
|||
}
|
||||
|
||||
const windows = objectMap(genWindowsInfo, (w, id) => {
|
||||
if (!w.open) {
|
||||
return null;
|
||||
}
|
||||
switch (id) {
|
||||
case "main":
|
||||
return (
|
||||
w.open && <MainWindow mediaPlayer={media} filePickers={filePickers} />
|
||||
);
|
||||
return <MainWindow mediaPlayer={media} filePickers={filePickers} />;
|
||||
case "equalizer":
|
||||
return w.open && <EqualizerWindow />;
|
||||
return <EqualizerWindow />;
|
||||
case "playlist":
|
||||
return w.open && <PlaylistWindow />;
|
||||
return <PlaylistWindow />;
|
||||
default:
|
||||
if (!w.generic) {
|
||||
throw new Error("Tried to render an unknown window:", id);
|
||||
}
|
||||
const Component = genWindowComponents[id];
|
||||
return (
|
||||
w.open && (
|
||||
<GenWindow title={w.title} windowId={id}>
|
||||
{({ height, width }) => (
|
||||
<Component
|
||||
analyser={media._analyser}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
)}
|
||||
</GenWindow>
|
||||
)
|
||||
<GenWindow title={w.title} windowId={id}>
|
||||
{({ height, width }) => (
|
||||
<Component
|
||||
analyser={media._analyser}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
)}
|
||||
</GenWindow>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue