Copy and layout improvements.

This commit is contained in:
Jennie Robinson Faber 2026-04-16 21:11:05 +01:00
parent 39eb9e039a
commit 02222a5c16
20 changed files with 464 additions and 652 deletions

View file

@ -25,10 +25,7 @@
<template v-else>
<!-- PAGE HEADER -->
<PageHeader
title="Edit Profile"
subtitle="How you appear to other members"
>
<PageHeader title="Edit Profile">
<NuxtLink
v-if="
memberId &&
@ -234,6 +231,44 @@
</div>
</div>
</PageSection>
<PageSection divider="top">
<div class="section-label">Recent Activity</div>
<div v-if="activityLoading" class="activity-empty">
Loading activity
</div>
<ul v-else-if="recentActivity.length" class="activity-list">
<li
v-for="entry in recentActivity"
:key="entry._id"
class="activity-item"
>
<div class="activity-time">
{{ formatActivityTime(entry.timestamp) }}
</div>
<div class="activity-text">
<template v-if="formatActivity(entry).link">
<span>{{
formatActivity(entry).text.split(
formatActivity(entry).linkText,
)[0]
}}</span>
<NuxtLink
:to="formatActivity(entry).link"
class="activity-link"
>
{{ formatActivity(entry).linkText }}
</NuxtLink>
</template>
<span v-else>{{ formatActivity(entry).text }}</span>
</div>
</li>
</ul>
<div v-else class="activity-empty">
Your activity will appear here as you use the Guild.
</div>
</PageSection>
</template>
</ColumnsLayout>
@ -269,6 +304,7 @@
<script setup>
import { MEMBER_STATUSES } from "~/composables/useMemberStatus";
import { TIMEZONE_OPTIONS } from "~/config/timezones";
import { formatActivity } from "~/utils/activityText";
definePageMeta({
middleware: "auth",
@ -333,13 +369,8 @@ const timezoneItems = computed(() => {
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",
label: "Registration & cancellation emails",
sub: "Confirmation when you register for an event, and notice if it's cancelled",
},
];
@ -370,7 +401,6 @@ const formData = reactive({
boardSlackHandle: "",
notifications: {
events: true,
updates: true,
},
});
@ -378,6 +408,39 @@ const loading = ref(false);
const saving = ref(false);
const initialData = ref(null);
const recentActivity = ref([]);
const activityLoading = ref(false);
const formatActivityTime = (date) => {
const now = new Date();
const d = new Date(date);
const diff = Math.floor((now - d) / 1000);
if (diff < 60) return "just now";
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
if (diff < 604800) return `${Math.floor(diff / 86400)}d ago`;
return d.toLocaleDateString("en-US", {
month: "short",
day: "numeric",
year: d.getFullYear() !== now.getFullYear() ? "numeric" : undefined,
});
};
const loadRecentActivity = async () => {
activityLoading.value = true;
try {
const data = await $fetch("/api/members/me/activity", {
params: { limit: 5 },
});
recentActivity.value = data.entries || [];
} catch (err) {
console.error("Failed to load activity:", err);
recentActivity.value = [];
} finally {
activityLoading.value = false;
}
};
const memberId = computed(() => memberData.value?._id || memberData.value?.id);
const hasChanges = computed(() => {
@ -405,7 +468,6 @@ const loadProfile = () => {
const notifs = memberData.value.notifications || {};
formData.notifications.events = notifs.events ?? true;
formData.notifications.updates = notifs.updates ?? true;
initialData.value = JSON.parse(JSON.stringify(formData));
};
@ -458,7 +520,10 @@ onMounted(async () => {
loadProfile();
if (memberId.value) {
await fetchPosts({ author: memberId.value });
await Promise.allSettled([
fetchPosts({ author: memberId.value }),
loadRecentActivity(),
]);
}
});
@ -712,6 +777,41 @@ useHead({
color: var(--ember);
}
/* ---- RECENT ACTIVITY ---- */
.activity-list {
list-style: none;
margin: 0;
padding: 0;
border-top: 1px dashed var(--border);
}
.activity-item {
padding: 8px 0;
border-bottom: 1px dashed var(--border);
font-size: 12px;
color: var(--text);
line-height: 1.5;
}
.activity-time {
font-size: 10px;
color: var(--text-faint);
margin-bottom: 2px;
}
.activity-text {
color: var(--text);
}
.activity-link {
color: var(--candle);
text-decoration: none;
}
.activity-link:hover {
text-decoration: underline;
}
.activity-empty {
font-size: 12px;
color: var(--text-faint);
padding: 10px 0;
}
/* ---- DISABLED BUTTON ---- */
.btn:disabled {
opacity: 0.4;
@ -743,84 +843,3 @@ useHead({
}
</style>
<style>
/* Non-scoped: targets USelectMenu button root which does not inherit scoped data attribute. */
button.timezone-select {
display: flex !important;
width: 100%;
padding: 5px 8px !important;
font-family: "Commit Mono", monospace !important;
font-size: 13px !important;
color: var(--text-bright) !important;
background: var(--input-bg) !important;
border: 1px solid var(--border) !important;
border-radius: 0 !important;
box-shadow: none !important;
outline: none !important;
min-height: 0;
--tw-ring-shadow: 0 0 #0000;
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-color: transparent;
}
button.timezone-select:hover {
background: var(--input-bg) !important;
}
button.timezone-select:focus,
button.timezone-select:focus-visible,
button.timezone-select[aria-expanded="true"] {
border-color: var(--candle) !important;
}
/* Popup content (portalled to body) */
.tz-content {
background: var(--input-bg) !important;
border: 1px solid var(--border) !important;
border-radius: 0 !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
--tw-ring-shadow: 0 0 #0000 !important;
--tw-ring-offset-shadow: 0 0 #0000 !important;
font-family: "Commit Mono", monospace !important;
}
/* Search input wrapper inside popup */
.tz-input {
border-bottom: 1px dashed var(--border) !important;
}
.tz-input input {
font-family: "Commit Mono", monospace !important;
font-size: 13px !important;
color: var(--text-bright) !important;
background: transparent !important;
border-radius: 0 !important;
padding: 6px 8px !important;
box-shadow: none !important;
--tw-ring-shadow: 0 0 #0000 !important;
--tw-ring-offset-shadow: 0 0 #0000 !important;
}
/* Option rows */
.tz-item {
font-family: "Commit Mono", monospace !important;
font-size: 13px !important;
color: var(--text) !important;
border-radius: 0 !important;
padding: 6px 8px !important;
}
.tz-item::before {
border-radius: 0 !important;
}
.tz-item[data-highlighted]::before,
.tz-item[data-highlighted]:not([data-disabled])::before {
background: var(--surface-hover) !important;
}
.tz-item[data-highlighted],
.tz-item[data-highlighted]:not([data-disabled]) {
color: var(--text-bright) !important;
}
</style>