-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70527b4
commit 1300893
Showing
26 changed files
with
481 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { z } from 'zod'; | ||
import { CustomShowSchema } from './schemas/customShowsSchema.js'; | ||
|
||
type Alias<T> = T & { _?: never }; | ||
|
||
export type CustomShow = Alias<z.infer<typeof CustomShowSchema>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { z } from 'zod'; | ||
|
||
export const CustomShowSchema = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
contentCount: z.number(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Paper, { PaperProps } from '@mui/material/Paper'; | ||
import { styled } from '@mui/material/styles'; | ||
|
||
const PaddedPaper = styled(Paper, { | ||
shouldForwardProp: () => true, | ||
})<PaperProps & { to?: string }>(() => ({ | ||
padding: 16, | ||
})); | ||
|
||
export default PaddedPaper; |
37 changes: 37 additions & 0 deletions
37
web2/src/components/channel_config/AddSelectedMediaButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { flattenDeep } from 'lodash-es'; | ||
import { sequentialPromises } from '../../helpers/util.ts'; | ||
import { enumeratePlexItem } from '../../hooks/plexHooks.ts'; | ||
import { addPlexMediaToCurrentChannel } from '../../store/channelEditor/actions.ts'; | ||
import useStore from '../../store/index.ts'; | ||
import Button from '@mui/material/Button'; | ||
|
||
type Props = { | ||
onSuccess: () => void; | ||
}; | ||
|
||
export default function AddSelectedMediaButton({ onSuccess }: Props) { | ||
const knownMedia = useStore((s) => s.knownMediaByServer); | ||
const selectedMedia = useStore((s) => s.selectedMedia); | ||
|
||
const addSelectedItems = () => { | ||
sequentialPromises(selectedMedia, (selected) => { | ||
const media = knownMedia[selected.server][selected.guid]; | ||
return enumeratePlexItem(selected.server, media)(); | ||
}) | ||
.then(flattenDeep) | ||
.then(addPlexMediaToCurrentChannel) | ||
.then(() => { | ||
onSuccess(); | ||
}) | ||
.catch(console.error); | ||
}; | ||
|
||
return ( | ||
<Button | ||
onClick={() => addSelectedItems()} | ||
disabled={selectedMedia.length === 0} | ||
> | ||
Add | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.