FEATURE: show the this weekend option on the bookmark modal (#15755)
This commit is contained in:
parent
bb9015e811
commit
cd2e7d5436
|
@ -14,12 +14,7 @@ import I18n from "I18n";
|
|||
import { action } from "@ember/object";
|
||||
import Component from "@ember/component";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import {
|
||||
MOMENT_MONDAY,
|
||||
now,
|
||||
startOfDay,
|
||||
thisWeekend,
|
||||
} from "discourse/lib/time-utils";
|
||||
import { MOMENT_MONDAY, now, startOfDay } from "discourse/lib/time-utils";
|
||||
import KeyboardShortcuts from "discourse/lib/keyboard-shortcuts";
|
||||
import { TIME_SHORTCUT_TYPES } from "discourse/lib/time-shortcut";
|
||||
import ItsATrap from "@discourse/itsatrap";
|
||||
|
@ -88,13 +83,6 @@ export default Component.extend({
|
|||
@discourseComputed()
|
||||
customTimeShortcutOptions() {
|
||||
return [
|
||||
{
|
||||
icon: "bed",
|
||||
id: "this_weekend",
|
||||
label: "time_shortcut.this_weekend",
|
||||
time: thisWeekend(),
|
||||
timeFormatKey: "dates.time_short_day",
|
||||
},
|
||||
{
|
||||
icon: "far-clock",
|
||||
id: "two_weeks",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
LATER_TODAY_CUTOFF_HOUR,
|
||||
MOMENT_FRIDAY,
|
||||
MOMENT_THURSDAY,
|
||||
START_OF_DAY_HOUR,
|
||||
laterToday,
|
||||
|
@ -283,6 +284,10 @@ export default Component.extend({
|
|||
if (now(this.userTimezone).day() >= MOMENT_THURSDAY) {
|
||||
this._hideOption(options, TIME_SHORTCUT_TYPES.LATER_THIS_WEEK);
|
||||
}
|
||||
|
||||
if (now(this.userTimezone).day() >= MOMENT_FRIDAY) {
|
||||
this._hideOption(options, TIME_SHORTCUT_TYPES.THIS_WEEKEND);
|
||||
}
|
||||
},
|
||||
|
||||
_hideOption(options, optionId) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
nextBusinessWeekStart,
|
||||
nextMonth,
|
||||
now,
|
||||
thisWeekend,
|
||||
tomorrow,
|
||||
} from "discourse/lib/time-utils";
|
||||
import I18n from "I18n";
|
||||
|
@ -13,6 +14,7 @@ import I18n from "I18n";
|
|||
export const TIME_SHORTCUT_TYPES = {
|
||||
LATER_TODAY: "later_today",
|
||||
TOMORROW: "tomorrow",
|
||||
THIS_WEEKEND: "this_weekend",
|
||||
NEXT_MONTH: "next_month",
|
||||
CUSTOM: "custom",
|
||||
RELATIVE: "relative",
|
||||
|
@ -48,6 +50,15 @@ export function defaultShortcutOptions(timezone) {
|
|||
I18n.t("dates.time_short_day")
|
||||
),
|
||||
},
|
||||
{
|
||||
icon: "bed",
|
||||
id: TIME_SHORTCUT_TYPES.THIS_WEEKEND,
|
||||
label: "time_shortcut.this_weekend",
|
||||
time: thisWeekend(timezone),
|
||||
timeFormatted: thisWeekend(timezone).format(
|
||||
I18n.t("dates.time_short_day")
|
||||
),
|
||||
},
|
||||
{
|
||||
icon: "briefcase",
|
||||
id: TIME_SHORTCUT_TYPES.START_OF_NEXT_BUSINESS_WEEK,
|
||||
|
|
|
@ -6,6 +6,7 @@ export const LATER_TODAY_MAX_HOUR = 18;
|
|||
export const MOMENT_SUNDAY = 0;
|
||||
export const MOMENT_MONDAY = 1;
|
||||
export const MOMENT_THURSDAY = 4;
|
||||
export const MOMENT_FRIDAY = 5;
|
||||
export const MOMENT_SATURDAY = 6;
|
||||
|
||||
export function now(timezone) {
|
||||
|
|
|
@ -47,6 +47,7 @@ discourseModule(
|
|||
I18n.t("time_shortcut.later_today"),
|
||||
I18n.t("time_shortcut.tomorrow"),
|
||||
I18n.t("time_shortcut.later_this_week"),
|
||||
I18n.t("time_shortcut.this_weekend"),
|
||||
I18n.t("time_shortcut.start_of_next_business_week"),
|
||||
I18n.t("time_shortcut.next_month"),
|
||||
I18n.t("time_shortcut.custom"),
|
||||
|
|
Loading…
Reference in New Issue