diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json
index 579c87827cc..e5f3a606f54 100644
--- a/apps/browser/src/_locales/en/messages.json
+++ b/apps/browser/src/_locales/en/messages.json
@@ -2225,6 +2225,9 @@
"sendTypeText": {
"message": "Text"
},
+ "sendTypeTextToShare": {
+ "message": "Text to share"
+ },
"sendTypeFile": {
"message": "File"
},
@@ -2236,13 +2239,16 @@
"message": "When accessing the Send, hide the text by default",
"description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated."
},
+ "hideTextByDefault": {
+ "message": "Hide text by default"
+ },
"limitSendViews": {
"message": "Limit views"
},
"limitSendViewsHint": {
"message": "No one can view this Send after the limit is reached. $ACCESSCOUNT$ views",
- "description": "Displayed under the limit views field on Send"
- },
+ "description": "Displayed under the limit views field on Send"
+ },
"limitSendViewsHintWithCount": {
"message": "No one can view this Send after the limit is reached. $ACCESSCOUNT$ views left",
"description": "Displayed under the limit views field on Send",
@@ -2252,7 +2258,7 @@
"example": "2"
}
}
- },
+ },
"maxAccessCountReached": {
"message": "Max access count reached",
"description": "This text will be displayed after a Send has been accessed the maximum amount of times."
@@ -2326,6 +2332,10 @@
"message": "The Send will be permanently deleted on the specified date and time.",
"description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated."
},
+ "deletionDateDescV2": {
+ "message": "The Send will be permanently deleted on this date.",
+ "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated."
+ },
"expirationDate": {
"message": "Expiration date"
},
diff --git a/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.html b/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.html
index 6475aa5f666..83242d5db30 100644
--- a/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.html
+++ b/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.html
@@ -11,21 +11,15 @@
- {{ "sendTypeText" | i18n }}
+ {{ "sendTypeTextToShare" | i18n }}
{{ "sendTextDesc" | i18n }}
- {{ "textHiddenByDefault" | i18n }}
+ {{ "hideTextByDefault" | i18n }}
-
- {{ "sendLinkLabel" | i18n }}
-
-
-
-
{{ "deletionDate" | i18n }}
-
-
-
- {{ "deletionDateDesc" | i18n }}
+ {{ "deletionDateDescV2" | i18n }}
diff --git a/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.ts b/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.ts
index 3522afefedb..b34b1aa319a 100644
--- a/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.ts
+++ b/libs/tools/send/send-ui/src/send-form/components/send-details/send-text-details.component.ts
@@ -27,14 +27,13 @@ enum DatePreset {
TwoDays = 48,
ThreeDays = 72,
SevenDays = 168,
+ FourteenDays = 336,
ThirtyDays = 720,
- Custom = 0,
- Never = null,
}
interface DatePresetSelectOption {
name: string;
- value: DatePreset;
+ value: DatePreset | string;
}
@Component({
@@ -67,19 +66,24 @@ export class SendTextDetailsComponent implements OnInit {
textToShare: [""],
hideTextByDefault: [false],
// sendLink: [null as string],
- defaultDeletionDateTime: ["", Validators.required],
selectedDeletionDatePreset: [DatePreset.SevenDays, Validators.required],
});
- deletionDatePresets: DatePresetSelectOption[] = [
- { name: this.i18nService.t("oneHour"), value: DatePreset.OneHour },
- { name: this.i18nService.t("oneDay"), value: DatePreset.OneDay },
- { name: this.i18nService.t("days", "2"), value: DatePreset.TwoDays },
- { name: this.i18nService.t("days", "3"), value: DatePreset.ThreeDays },
- { name: this.i18nService.t("days", "7"), value: DatePreset.SevenDays },
- { name: this.i18nService.t("days", "30"), value: DatePreset.ThirtyDays },
- { name: this.i18nService.t("custom"), value: DatePreset.Custom },
- ];
+ get deletionDatePresets(): DatePresetSelectOption[] {
+ const defaultSelections = [
+ { name: this.i18nService.t("oneHour"), value: DatePreset.OneHour },
+ { name: this.i18nService.t("oneDay"), value: DatePreset.OneDay },
+ { name: this.i18nService.t("days", "2"), value: DatePreset.TwoDays },
+ { name: this.i18nService.t("days", "3"), value: DatePreset.ThreeDays },
+ { name: this.i18nService.t("days", "7"), value: DatePreset.SevenDays },
+ { name: this.i18nService.t("days", "14"), value: DatePreset.FourteenDays },
+ { name: this.i18nService.t("days", "30"), value: DatePreset.ThirtyDays },
+ ];
+ if (!this.originalSendView.deletionDate) {
+ return defaultSelections;
+ }
+ return [{ name: null, value: this.formattedDeletionDate }, ...defaultSelections];
+ }
constructor(
private sendFormContainer: SendFormContainer,
@@ -108,44 +112,20 @@ export class SendTextDetailsComponent implements OnInit {
name: this.originalSendView.name,
textToShare: this.originalSendView.text.text,
hideTextByDefault: this.originalSendView.text.hidden,
- defaultDeletionDateTime: this.datePipe.transform(
- new Date(this.originalSendView.deletionDate),
- "yyyy-MM-ddTHH:mm",
- ),
- selectedDeletionDatePreset:
- this.config.mode === "edit" ? DatePreset.Custom : DatePreset.SevenDays,
+ selectedDeletionDatePreset: DatePreset.SevenDays,
});
}
-
- this.sendTextDetailsForm.controls.selectedDeletionDatePreset.valueChanges
- .pipe(takeUntilDestroyed())
- .subscribe((datePreset) => {
- datePreset === DatePreset.Custom
- ? this.sendTextDetailsForm.controls.defaultDeletionDateTime.enable()
- : this.sendTextDetailsForm.controls.defaultDeletionDateTime.disable();
- });
}
get formattedDeletionDate(): string {
- switch (this.sendTextDetailsForm.controls.selectedDeletionDatePreset.value as DatePreset) {
- case DatePreset.Never:
- this.sendTextDetailsForm.controls.selectedDeletionDatePreset.patchValue(
- DatePreset.SevenDays,
- );
- return this.formattedDeletionDate;
- case DatePreset.Custom:
- return this.sendTextDetailsForm.controls.defaultDeletionDateTime.value;
- default: {
- const now = new Date();
- const milliseconds = now.setTime(
- now.getTime() +
- (this.sendTextDetailsForm.controls.selectedDeletionDatePreset.value as number) *
- 60 *
- 60 *
- 1000,
- );
- return new Date(milliseconds).toString();
- }
- }
+ const now = new Date();
+ const milliseconds = now.setTime(
+ now.getTime() +
+ (this.sendTextDetailsForm.controls.selectedDeletionDatePreset.value as number) *
+ 60 *
+ 60 *
+ 1000,
+ );
+ return new Date(milliseconds).toString();
}
}