feat(member): account/profile polish + tier upgrade flow
- Timezone: curated USelectMenu dropdown (app/config/timezones.js), preserves unknown saved values
- Profile save now uses useToast() for success/error; remove inline save banner
- Nav onboarding dot nudged down 1px for optical alignment with lowercase text
- Onboarding: skip a suggestion with POST /api/onboarding/track {skip}; member.onboarding.skipped map; does not affect graduation
- CirclePicker takes :saved-value so 'Current' badge stays until save completes
- PrivacyToggle is binary (USwitch labeled Private); member schema enum reduced to ['members','private']; zod coerces legacy 'public'
- New /member/payment-setup page: HelcimPay $0 verify + update-contribution, wired from account.vue via requiresPaymentSetup redirect
- Helcim portal: NUXT_PUBLIC_HELCIM_PORTAL_URL env + account.vue 'Manage billing in Helcim' link
- Migration script: scripts/migrate-privacy-public-to-members.js
This commit is contained in:
parent
08fc3884da
commit
7292b11c0b
18 changed files with 604 additions and 122 deletions
|
|
@ -65,10 +65,14 @@
|
|||
</div>
|
||||
<div class="field">
|
||||
<label>Timezone</label>
|
||||
<input
|
||||
<USelectMenu
|
||||
v-model="formData.timeZone"
|
||||
type="text"
|
||||
placeholder="e.g., America/Toronto"
|
||||
:items="timezoneItems"
|
||||
value-key="value"
|
||||
searchable
|
||||
searchable-placeholder="Search timezones..."
|
||||
placeholder="Select a timezone"
|
||||
class="timezone-select"
|
||||
/>
|
||||
<PrivacyToggle v-model="formData.timeZonePrivacy" />
|
||||
</div>
|
||||
|
|
@ -242,12 +246,6 @@
|
|||
<button type="button" class="btn" @click="resetForm">
|
||||
Reset Changes
|
||||
</button>
|
||||
<span v-if="saveSuccess" class="save-msg save-msg-ok"
|
||||
>Profile updated.</span
|
||||
>
|
||||
<span v-if="saveError" class="save-msg save-msg-err">{{
|
||||
saveError
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -264,6 +262,7 @@
|
|||
|
||||
<script setup>
|
||||
import { MEMBER_STATUSES } from "~/composables/useMemberStatus";
|
||||
import { TIMEZONE_OPTIONS } from "~/config/timezones";
|
||||
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
|
|
@ -283,6 +282,16 @@ const availableGhosts = [
|
|||
{ value: "wtf", label: "WTF", image: "/ghosties/Ghost-WTF.png" },
|
||||
];
|
||||
|
||||
// Include the saved timezone as a custom option if it's not in the curated list.
|
||||
const timezoneItems = computed(() => {
|
||||
const saved = formData.timeZone;
|
||||
const list = [...TIMEZONE_OPTIONS];
|
||||
if (saved && !list.some((t) => t.value === saved)) {
|
||||
list.unshift({ label: saved, value: saved });
|
||||
}
|
||||
return list;
|
||||
});
|
||||
|
||||
const notificationToggles = [
|
||||
{ key: "events", label: "Event reminders", sub: "Get notified about upcoming events" },
|
||||
{ key: "updates", label: "Community updates", sub: "New posts from members you follow" },
|
||||
|
|
@ -328,10 +337,7 @@ const formData = reactive({
|
|||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const saveSuccess = ref(false);
|
||||
const saveError = ref(null);
|
||||
const initialData = ref(null);
|
||||
let saveSuccessTimer = null;
|
||||
|
||||
const memberId = computed(() => memberData.value?._id || memberData.value?.id);
|
||||
|
||||
|
|
@ -376,8 +382,6 @@ const loadProfile = () => {
|
|||
|
||||
const handleSubmit = async () => {
|
||||
saving.value = true;
|
||||
saveSuccess.value = false;
|
||||
saveError.value = null;
|
||||
|
||||
try {
|
||||
await $fetch("/api/members/profile", {
|
||||
|
|
@ -385,20 +389,17 @@ const handleSubmit = async () => {
|
|||
body: { ...formData },
|
||||
});
|
||||
|
||||
saveSuccess.value = true;
|
||||
|
||||
await checkMemberStatus();
|
||||
loadProfile();
|
||||
|
||||
if (saveSuccessTimer) clearTimeout(saveSuccessTimer);
|
||||
saveSuccessTimer = setTimeout(() => {
|
||||
saveSuccess.value = false;
|
||||
saveSuccessTimer = null;
|
||||
}, 3000);
|
||||
toast.add({ title: "Profile updated", color: "success" });
|
||||
} catch (error) {
|
||||
console.error("Profile save error:", error);
|
||||
saveError.value =
|
||||
error.data?.message || "Failed to save profile. Please try again.";
|
||||
toast.add({
|
||||
title: "Update failed",
|
||||
description: error.data?.statusMessage || error.data?.message || "Please try again.",
|
||||
color: "error",
|
||||
});
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
|
|
@ -406,8 +407,6 @@ const handleSubmit = async () => {
|
|||
|
||||
const resetForm = () => {
|
||||
loadProfile();
|
||||
saveSuccess.value = false;
|
||||
saveError.value = null;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -452,10 +451,6 @@ const handleDeletePost = async (post) => {
|
|||
}
|
||||
};
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (saveSuccessTimer) clearTimeout(saveSuccessTimer);
|
||||
});
|
||||
|
||||
useHead({
|
||||
title: "Edit Profile - Ghost Guild",
|
||||
});
|
||||
|
|
@ -708,17 +703,9 @@ useHead({
|
|||
gap: 12px;
|
||||
}
|
||||
|
||||
.save-msg {
|
||||
font-size: 11px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.save-msg-ok {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
.save-msg-err {
|
||||
color: var(--ember);
|
||||
/* ---- TIMEZONE SELECT ---- */
|
||||
.timezone-select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ---- RESPONSIVE ---- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue