import { For, Match, Show, Switch } from "solid-js"; import { Trans } from "@lingui-solid/solid/macro"; import dayjs from "dayjs"; import { Channel } from "stoat.js"; import { useState } from "@revolt/state"; import { Column, Text, Time } from "@revolt/ui"; import MdAlternateEmail from "@material-design-icons/svg/outlined/alternate_email.svg?component-solid"; import MdNotificationsActive from "@material-design-icons/svg/outlined/notifications_active.svg?component-solid"; import MdNotificationsOff from "@material-design-icons/svg/outlined/notifications_off.svg?component-solid"; import MdDoNotDisturbOff from "@material-symbols/svg-400/outlined/do_not_disturb_off.svg?component-solid"; import MdDoNotDisturbOn from "@material-symbols/svg-400/outlined/do_not_disturb_on.svg?component-solid"; import MdNotificationSettings from "@material-symbols/svg-400/outlined/notification_settings.svg?component-solid"; import MdRadioButtonChecked from "@material-symbols/svg-400/outlined/radio_button_checked-fill.svg?component-solid"; import MdRadioButtonUnchecked from "@material-symbols/svg-400/outlined/radio_button_unchecked.svg?component-solid"; import { ContextMenuButton, ContextMenuSubMenu } from "../ContextMenu"; export function NotificationContextMenu(props: { channel: Channel }) { const state = useState(); return ( <> state.notifications.setChannelMute(props.channel, undefined) } symbol={MdDoNotDisturbOff} _titleCase={false} > Unmute Channel Muted until{" "} } > state.notifications.setChannelMute(props.channel, {})} buttonContent={Mute Channel} symbol={MdDoNotDisturbOn} > For 15 minutes], [60, For 1 hour], [180, For 3 hours], [480, For 8 hours], [1440, For 24 hours], [undefined, Until I turn it back on], ] as const } > {([timeMin, i18n]) => ( state.notifications.setChannelMute(props.channel, { until: timeMin ? +dayjs().add(timeMin, "minutes") : undefined, }) } _titleCase={false} > {i18n} )} Notifications} > state.notifications.setChannel(props.channel, undefined) } actionSymbol={ typeof state.notifications.getChannel(props.channel) === "undefined" ? MdRadioButtonChecked : MdRadioButtonUnchecked } > Default}> Server Default None}> All Messages Mentions Only state.notifications.setChannel(props.channel, "all")} actionSymbol={ state.notifications.getChannel(props.channel) === "all" ? MdRadioButtonChecked : MdRadioButtonUnchecked } > All Messages state.notifications.setChannel(props.channel, "mention") } actionSymbol={ state.notifications.getChannel(props.channel) === "mention" ? MdRadioButtonChecked : MdRadioButtonUnchecked } > Mentions Only state.notifications.setChannel(props.channel, "none")} actionSymbol={ state.notifications.getChannel(props.channel) === "none" ? MdRadioButtonChecked : MdRadioButtonUnchecked } > None ); }