mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-08-02 14:52:15 +00:00
handle if currently selected profile is deleted, slight ui changes to channels form
This commit is contained in:
parent
d2dbbcc136
commit
970734c5df
3 changed files with 92 additions and 56 deletions
|
|
@ -380,7 +380,7 @@ const Channel = ({ channel = null, isOpen, onClose }) => {
|
|||
<Divider size="sm" orientation="vertical" />
|
||||
|
||||
<Stack justify="flex-start" style={{ flex: 1 }}>
|
||||
<Flex gap="sm">
|
||||
<Group justify="space-between">
|
||||
<Select
|
||||
id="logo_id"
|
||||
name="logo_id"
|
||||
|
|
@ -399,17 +399,15 @@ const Channel = ({ channel = null, isOpen, onClose }) => {
|
|||
renderOption={renderLogoOption}
|
||||
comboboxProps={{ width: 75, position: 'bottom-start' }}
|
||||
/>
|
||||
<Flex align="flex-end" style={{ marginTop: 10 }}>
|
||||
<img
|
||||
src={
|
||||
logos[formik.values.logo_id]
|
||||
? logos[formik.values.logo_id].url
|
||||
: logo
|
||||
}
|
||||
height="40"
|
||||
/>
|
||||
</Flex>
|
||||
</Flex>
|
||||
<img
|
||||
src={
|
||||
logos[formik.values.logo_id]
|
||||
? logos[formik.values.logo_id].url
|
||||
: logo
|
||||
}
|
||||
height="40"
|
||||
/>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
<Divider size="xs" style={{ flex: 1 }} />
|
||||
|
|
|
|||
|
|
@ -652,51 +652,74 @@ const StreamsTable = ({}) => {
|
|||
}}
|
||||
>
|
||||
{/* Top toolbar with Remove, Assign, Auto-match, and Add buttons */}
|
||||
<Box
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
<Flex gap={6}>
|
||||
<Button
|
||||
leftSection={<SquareMinus size={18} />}
|
||||
variant="default"
|
||||
size="xs"
|
||||
onClick={deleteStreams}
|
||||
disabled={rowSelection.length === 0}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
<Group justify="space-between" style={{ paddingLeft: 10 }}>
|
||||
<Box>
|
||||
{selectedStreamIds.length > 0 && (
|
||||
<Button
|
||||
leftSection={<IconSquarePlus size={18} />}
|
||||
variant="light"
|
||||
size="xs"
|
||||
onClick={addStreamsToChannel}
|
||||
p={5}
|
||||
color={theme.tailwind.green[5]}
|
||||
style={{
|
||||
borderWidth: '1px',
|
||||
borderColor: theme.tailwind.green[5],
|
||||
color: 'white',
|
||||
}}
|
||||
>
|
||||
Add Streams to Channel
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
<Button
|
||||
leftSection={<IconSquarePlus size={18} />}
|
||||
variant="default"
|
||||
size="xs"
|
||||
onClick={createChannelsFromStreams}
|
||||
p={5}
|
||||
>
|
||||
Create Channels
|
||||
</Button>
|
||||
<Box
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
padding: 10,
|
||||
}}
|
||||
>
|
||||
<Flex gap={6}>
|
||||
<Button
|
||||
leftSection={<SquareMinus size={18} />}
|
||||
variant="default"
|
||||
size="xs"
|
||||
onClick={deleteStreams}
|
||||
disabled={selectedStreamIds.length == 0}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
leftSection={<IconSquarePlus size={18} />}
|
||||
variant="light"
|
||||
size="xs"
|
||||
onClick={() => editStream()}
|
||||
p={5}
|
||||
color={theme.tailwind.green[5]}
|
||||
style={{
|
||||
borderWidth: '1px',
|
||||
borderColor: theme.tailwind.green[5],
|
||||
color: 'white',
|
||||
}}
|
||||
>
|
||||
Add Stream
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
<Button
|
||||
leftSection={<IconSquarePlus size={18} />}
|
||||
variant="default"
|
||||
size="xs"
|
||||
onClick={createChannelsFromStreams}
|
||||
p={5}
|
||||
disabled={selectedStreamIds.length == 0}
|
||||
>
|
||||
Create Channels
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
leftSection={<IconSquarePlus size={18} />}
|
||||
variant="light"
|
||||
size="xs"
|
||||
onClick={() => editStream()}
|
||||
p={5}
|
||||
color={theme.tailwind.green[5]}
|
||||
style={{
|
||||
borderWidth: '1px',
|
||||
borderColor: theme.tailwind.green[5],
|
||||
color: 'white',
|
||||
}}
|
||||
>
|
||||
Create Stream
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
</Group>
|
||||
|
||||
{initialDataCount === 0 && (
|
||||
<Center style={{ paddingTop: 20 }}>
|
||||
|
|
|
|||
|
|
@ -240,7 +240,22 @@ const useChannelsStore = create((set, get) => ({
|
|||
delete updatedProfiles[id];
|
||||
}
|
||||
|
||||
return { profiles: updatedProfiles };
|
||||
let additionalUpdates = {};
|
||||
if (profileIds.includes(state.selectedProfileId)) {
|
||||
additionalUpdates = {
|
||||
selectedProfileId: '0',
|
||||
selectedProfileChannels: [],
|
||||
selectedProfile: {},
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
profiles: updatedProfiles,
|
||||
selectedProfileId: profileIds.includes(state.selectedProfileId)
|
||||
? '0'
|
||||
: state.selectedProfileId,
|
||||
...additionalUpdates,
|
||||
};
|
||||
}),
|
||||
|
||||
updateProfileChannel: (channelId, profileId, enabled) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue