forked from jsnbuchanan/crowd-funder-for-time-pwa
Extract literal strings from complex modals to notification constants
Replace hardcoded text in raw $notify calls with centralized constants: - MembersList.vue: 2 complex modals (contact admission workflow) - ContactsView.vue: 2 complex modals (registration, onboarding meeting) - ProjectViewView.vue: 1 complex modal (claim confirmation) Preserves advanced modal features (promptToStopAsking, custom buttons, nested workflows) while standardizing text through constants for maintainability and future localization support.
This commit is contained in:
@@ -192,6 +192,10 @@ import * as libsUtil from "../libs/util";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import {
|
||||
NOTIFY_ADD_CONTACT_FIRST,
|
||||
NOTIFY_CONTINUE_WITHOUT_ADDING,
|
||||
} from "@/constants/notifications";
|
||||
|
||||
interface Member {
|
||||
admitted: boolean;
|
||||
@@ -378,10 +382,10 @@ export default class MembersList extends Vue {
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "Add as Contact First?",
|
||||
text: "This person is not in your contacts. Would you like to add them as a contact first?",
|
||||
yesText: "Add as Contact",
|
||||
noText: "Skip Adding Contact",
|
||||
title: NOTIFY_ADD_CONTACT_FIRST.title,
|
||||
text: NOTIFY_ADD_CONTACT_FIRST.text,
|
||||
yesText: NOTIFY_ADD_CONTACT_FIRST.yesText,
|
||||
noText: NOTIFY_ADD_CONTACT_FIRST.noText,
|
||||
onYes: async () => {
|
||||
await this.addAsContact(decrMember);
|
||||
// After adding as contact, proceed with admission
|
||||
@@ -393,9 +397,9 @@ export default class MembersList extends Vue {
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "Continue Without Adding?",
|
||||
text: "Are you sure you want to proceed with admission? If they are not a contact, you will not know their name after this meeting.",
|
||||
yesText: "Continue",
|
||||
title: NOTIFY_CONTINUE_WITHOUT_ADDING.title,
|
||||
text: NOTIFY_CONTINUE_WITHOUT_ADDING.text,
|
||||
yesText: NOTIFY_CONTINUE_WITHOUT_ADDING.yesText,
|
||||
onYes: async () => {
|
||||
await this.toggleAdmission(decrMember);
|
||||
},
|
||||
|
||||
@@ -122,3 +122,37 @@ export const NOTIFY_UNCONFIRMED_HOURS = {
|
||||
title: "Unconfirmed Hours",
|
||||
message: "Would you like to confirm some of those hours?",
|
||||
};
|
||||
|
||||
// Complex modal constants (for raw $notify calls with advanced features)
|
||||
// MembersList.vue complex modals
|
||||
export const NOTIFY_ADD_CONTACT_FIRST = {
|
||||
title: "Add as Contact First?",
|
||||
text: "This person is not in your contacts. Would you like to add them as a contact first?",
|
||||
yesText: "Add as Contact",
|
||||
noText: "Skip Adding Contact",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTINUE_WITHOUT_ADDING = {
|
||||
title: "Continue Without Adding?",
|
||||
text: "Are you sure you want to proceed with admission? If they are not a contact, you will not know their name after this meeting.",
|
||||
yesText: "Continue",
|
||||
};
|
||||
|
||||
// ContactsView.vue complex modals
|
||||
export const NOTIFY_REGISTER_CONTACT = {
|
||||
title: "Register",
|
||||
text: "Do you want to register them?",
|
||||
};
|
||||
|
||||
export const NOTIFY_ONBOARDING_MEETING = {
|
||||
title: "Onboarding Meeting",
|
||||
text: "Would you like to start a new meeting?",
|
||||
yesText: "Start New Meeting",
|
||||
noText: "Join Existing Meeting",
|
||||
};
|
||||
|
||||
// ProjectViewView.vue complex modals
|
||||
export const NOTIFY_CONFIRM_CLAIM = {
|
||||
title: "Confirm",
|
||||
text: "Do you personally confirm that this is true?",
|
||||
};
|
||||
|
||||
@@ -309,6 +309,8 @@ import {
|
||||
NOTIFY_REGISTER_PERSON_ERROR,
|
||||
NOTIFY_VISIBILITY_ERROR,
|
||||
NOTIFY_UNCONFIRMED_HOURS,
|
||||
NOTIFY_REGISTER_CONTACT,
|
||||
NOTIFY_ONBOARDING_MEETING,
|
||||
} from "@/constants/notifications";
|
||||
|
||||
@Component({
|
||||
@@ -636,10 +638,8 @@ export default class ContactsView extends Vue {
|
||||
resp.status,
|
||||
resp.data,
|
||||
);
|
||||
this.notify.error(
|
||||
`Got an error retrieving your ${useRecipient ? "given" : "received"} data from the server.`,
|
||||
TIMEOUTS.STANDARD,
|
||||
);
|
||||
const message = `Got an error retrieving your ${useRecipient ? "given" : "received"} data from the server.`;
|
||||
this.notify.error(message, TIMEOUTS.STANDARD);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -882,8 +882,8 @@ export default class ContactsView extends Vue {
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "Register",
|
||||
text: "Do you want to register them?",
|
||||
title: NOTIFY_REGISTER_CONTACT.title,
|
||||
text: NOTIFY_REGISTER_CONTACT.text,
|
||||
onCancel: async (stopAsking?: boolean) => {
|
||||
if (stopAsking) {
|
||||
await this.$updateSettings({
|
||||
@@ -1237,16 +1237,16 @@ export default class ContactsView extends Vue {
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "Onboarding Meeting",
|
||||
text: "Would you like to start a new meeting?",
|
||||
title: NOTIFY_ONBOARDING_MEETING.title,
|
||||
text: NOTIFY_ONBOARDING_MEETING.text,
|
||||
onYes: async () => {
|
||||
this.$router.push({ name: "onboard-meeting-setup" });
|
||||
},
|
||||
yesText: "Start New Meeting",
|
||||
yesText: NOTIFY_ONBOARDING_MEETING.yesText,
|
||||
onNo: async () => {
|
||||
this.$router.push({ name: "onboard-meeting-list" });
|
||||
},
|
||||
noText: "Join Existing Meeting",
|
||||
noText: NOTIFY_ONBOARDING_MEETING.noText,
|
||||
},
|
||||
TIMEOUTS.MODAL,
|
||||
);
|
||||
|
||||
@@ -610,6 +610,7 @@ import { useClipboard } from "@vueuse/core";
|
||||
import { transformImageUrlForCors } from "../libs/util";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import { NOTIFY_CONFIRM_CLAIM } from "@/constants/notifications";
|
||||
/**
|
||||
* Project View Component
|
||||
* @author Matthew Raymer
|
||||
@@ -1339,8 +1340,8 @@ export default class ProjectViewView extends Vue {
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "Confirm",
|
||||
text: "Do you personally confirm that this is true?",
|
||||
title: NOTIFY_CONFIRM_CLAIM.title,
|
||||
text: NOTIFY_CONFIRM_CLAIM.text,
|
||||
onYes: async () => {
|
||||
await this.confirmClaim(give);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user