diff --git a/frontend/src/components/tables/ChannelsTable.jsx b/frontend/src/components/tables/ChannelsTable.jsx
index d3de2c00..86ea4b9c 100644
--- a/frontend/src/components/tables/ChannelsTable.jsx
+++ b/frontend/src/components/tables/ChannelsTable.jsx
@@ -312,8 +312,12 @@ const ChannelsTable = ({}) => {
() => [
{
id: 'enabled',
- header: ,
- size: 40,
+ header: (
+
+
+
+ ),
+ size: 50,
enableSorting: false,
accessorFn: (row) => {
if (selectedProfileId == '0') {
diff --git a/frontend/src/store/channels.jsx b/frontend/src/store/channels.jsx
index e9c69d48..b8ca53b5 100644
--- a/frontend/src/store/channels.jsx
+++ b/frontend/src/store/channels.jsx
@@ -74,16 +74,32 @@ const useChannelsStore = create((set, get) => ({
addChannel: (newChannel) => {
get().fetchChannelProfiles();
- set((state) => ({
- channels: {
- ...state.channels,
- [newChannel.id]: newChannel,
- },
- channelsByUUID: {
- ...state.channelsByUUID,
- [newChannel.uuid]: newChannel.id,
- },
- }));
+ set((state) => {
+ const profiles = { ...state.profiles };
+ Object.values(profiles).forEach((item) => {
+ item.channels.push({
+ id: newChannel.id,
+ enabled: true,
+ });
+ });
+
+ return {
+ channels: {
+ ...state.channels,
+ [newChannel.id]: newChannel,
+ },
+ channelsByUUID: {
+ ...state.channelsByUUID,
+ [newChannel.uuid]: newChannel.id,
+ },
+ profiles,
+ selectedProfile: profiles[state.selectedProfileId],
+ selectedProfileChannels:
+ state.selectedProfileId == '0'
+ ? []
+ : profiles[state.selectedProfileId].channels,
+ };
+ });
},
addChannels: (newChannels) => {
@@ -98,6 +114,14 @@ const useChannelsStore = create((set, get) => ({
}
return acc;
}, {});
+ const profileChannels = newChannels.map((channel) => ({
+ id: channel.id,
+ enabled: true,
+ }));
+ const profiles = { ...state.profiles };
+ Object.values(profiles).forEach((item) => {
+ item.channels.concat(profileChannels); // Append a new channel object
+ });
return set((state) => ({
channels: {
...state.channels,
@@ -111,6 +135,9 @@ const useChannelsStore = create((set, get) => ({
...state.logos,
...logos,
},
+ profiles,
+ selectedProfile: profiles[state.selectedProfileId],
+ selectedProfileChannels: profiles[state.selectedProfileId].channels,
}));
},