Skip to content

Commit

Permalink
added dummy dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed Feb 22, 2024
1 parent 4ba71ad commit 47b92f3
Show file tree
Hide file tree
Showing 2 changed files with 479 additions and 3 deletions.
28 changes: 25 additions & 3 deletions packages/admin/src/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
IconExpert,
ToggleThemeMenu,
} from '@iobroker/adapter-react-v5';
import NotificationsDialog from '@/dialogs/NotificationsDialog';
import Utils from './components/Utils'; // adapter-react-v5/Components/Utils';

import CommandDialog from './dialogs/CommandDialog';
Expand Down Expand Up @@ -499,6 +500,8 @@ class App extends Router {
triggerAdapterUpdate: 0,

updating: false, // js controller updating
/** If the notifications dialog should be shown */
notificationsDialog: false,
/** Notifications, excluding the system ones */
notifications: {},
/** Number of new notifications */
Expand Down Expand Up @@ -1256,6 +1259,25 @@ class App extends Router {
});
};

/**
* Render the notifications dialog
* @return {React.ReactNode}
*/
renderNotificationsDialog() {
if (!this.state.notificationsDialog) {
return null;
}

return <NotificationsDialog
messages={{}}
onClose={() => this.setState({ notificationsDialog: false })}
ackCallback={() => console.log('ask')}
dateFormat={this.state.systemConfig.common.dateFormat}
themeType={this.state.themeType}
instances={{}}
/>;
}

renderHostWarningDialog() {
if (!this.state.showHostWarning) {
return null;
Expand All @@ -1266,7 +1288,6 @@ class App extends Router {
messages={this.state.showHostWarning.result.system.categories}
dateFormat={this.state.systemConfig.common.dateFormat}
themeType={this.state.themeType}
themeName={this.state.themeName}
ackCallback={name => this.socket.clearNotifications(this.state.showHostWarning.host, name)}
onClose={() => this.setState({ showHostWarning: null })}
/>;
Expand Down Expand Up @@ -1295,7 +1316,7 @@ class App extends Router {
}
}

this.setState({ noNotifications });
this.setState({ noNotifications, notifications });
}

showAdaptersWarning = (notifications, socket, host) => {
Expand Down Expand Up @@ -2546,7 +2567,7 @@ class App extends Router {

<IconButton
size="large"
onClick={() => Router.doNavigate(null, 'discovery')}
onClick={() => this.setState({ notificationsDialog: true })}
>
<Tooltip title={I18n.t('Notifications')}>
<Badge
Expand Down Expand Up @@ -2684,6 +2705,7 @@ class App extends Router {
{this.renderSlowConnectionWarning()}
{this.renderNewsDialog()}
{this.renderHostWarningDialog()}
{this.renderNotificationsDialog()}
{!this.state.connected && !this.state.redirectCountDown && !this.state.updating ? (
<Connecting />
) : null}
Expand Down
Loading

0 comments on commit 47b92f3

Please sign in to comment.