From 67ce1118618e8fcfdb431fe6e39795647f7b3031 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 20 Nov 2024 10:50:15 +0100 Subject: [PATCH] DEV: converts do-not-disturb to gjs (#29840) --- .../app/components/modal/do-not-disturb.gjs | 84 +++++++++++++++++++ .../app/components/modal/do-not-disturb.hbs | 48 ----------- .../app/components/modal/do-not-disturb.js | 28 ------- 3 files changed, 84 insertions(+), 76 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/modal/do-not-disturb.gjs delete mode 100644 app/assets/javascripts/discourse/app/components/modal/do-not-disturb.hbs delete mode 100644 app/assets/javascripts/discourse/app/components/modal/do-not-disturb.js diff --git a/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.gjs b/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.gjs new file mode 100644 index 00000000000..e4b072a1029 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.gjs @@ -0,0 +1,84 @@ +import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; +import { action } from "@ember/object"; +import { service } from "@ember/service"; +import DButton from "discourse/components/d-button"; +import DModal from "discourse/components/d-modal"; +import TapTile from "discourse/components/tap-tile"; +import TapTileGrid from "discourse/components/tap-tile-grid"; +import { extractError } from "discourse/lib/ajax-error"; +import { i18n } from "discourse-i18n"; + +export default class DoNotDisturb extends Component { + @service currentUser; + @service router; + + @tracked flash; + + @action + async saveDuration(duration) { + try { + await this.currentUser.enterDoNotDisturbFor(duration); + this.args.closeModal(); + } catch (e) { + this.flash = extractError(e); + } + } + + @action + navigateToNotificationSchedule() { + this.router.transitionTo("preferences.notifications", this.currentUser); + this.args.closeModal(); + } + + +} diff --git a/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.hbs b/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.hbs deleted file mode 100644 index 489ce0eb07b..00000000000 --- a/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.hbs +++ /dev/null @@ -1,48 +0,0 @@ - - <:body> - - - {{i18n "pause_notifications.options.half_hour"}} - - - {{i18n "pause_notifications.options.one_hour"}} - - - {{i18n "pause_notifications.options.two_hours"}} - - - {{i18n "pause_notifications.options.tomorrow"}} - - - - - - \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.js b/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.js deleted file mode 100644 index 0f5a9949a8d..00000000000 --- a/app/assets/javascripts/discourse/app/components/modal/do-not-disturb.js +++ /dev/null @@ -1,28 +0,0 @@ -import Component from "@glimmer/component"; -import { tracked } from "@glimmer/tracking"; -import { action } from "@ember/object"; -import { service } from "@ember/service"; -import { extractError } from "discourse/lib/ajax-error"; - -export default class DoNotDisturb extends Component { - @service currentUser; - @service router; - - @tracked flash; - - @action - async saveDuration(duration) { - try { - await this.currentUser.enterDoNotDisturbFor(duration); - this.args.closeModal(); - } catch (e) { - this.flash = extractError(e); - } - } - - @action - navigateToNotificationSchedule() { - this.router.transitionTo("preferences.notifications", this.currentUser); - this.args.closeModal(); - } -}