@commonpub/layer 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/SiteLogo.vue +3 -17
- package/layouts/default.vue +4 -0
- package/package.json +5 -5
- package/pages/settings/index.vue +3 -76
- package/pages/settings.vue +73 -0
- package/server/utils/instanceTheme.ts +1 -1
- package/theme/agora-dark.css +4 -0
- package/theme/agora.css +10 -0
package/components/SiteLogo.vue
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="cpub-site-logo">
|
|
3
|
-
<!-- Classic logo
|
|
3
|
+
<!-- Classic logo -->
|
|
4
4
|
<span class="cpub-logo-classic">
|
|
5
5
|
<span class="cpub-logo-bracket">[</span>C<span class="cpub-logo-bracket">]</span>
|
|
6
6
|
<span class="cpub-logo-name">CommonPub</span>
|
|
7
7
|
</span>
|
|
8
8
|
|
|
9
|
-
<!-- Agora logo:
|
|
9
|
+
<!-- Agora logo: Town Square mark + Fraunces wordmark -->
|
|
10
10
|
<span class="cpub-logo-agora">
|
|
11
|
-
<!-- Town Square mark: 4 blocks with content lines + green center -->
|
|
12
11
|
<svg class="cpub-logo-mark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200" width="22" height="22" aria-hidden="true">
|
|
13
12
|
<rect x="18" y="18" width="72" height="72" fill="none" stroke="currentColor" stroke-width="7" stroke-linejoin="round"/>
|
|
14
13
|
<rect x="110" y="18" width="72" height="72" fill="none" stroke="currentColor" stroke-width="7" stroke-linejoin="round"/>
|
|
@@ -34,7 +33,6 @@
|
|
|
34
33
|
white-space: nowrap;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
/* Classic logo */
|
|
38
36
|
.cpub-logo-classic {
|
|
39
37
|
display: flex;
|
|
40
38
|
align-items: center;
|
|
@@ -45,7 +43,7 @@
|
|
|
45
43
|
.cpub-logo-bracket { color: var(--accent); font-size: 15px; }
|
|
46
44
|
.cpub-logo-name { margin-left: 2px; }
|
|
47
45
|
|
|
48
|
-
/* Agora logo
|
|
46
|
+
/* Agora logo hidden by default — shown via agora.css */
|
|
49
47
|
.cpub-logo-agora {
|
|
50
48
|
display: none;
|
|
51
49
|
align-items: center;
|
|
@@ -60,15 +58,3 @@
|
|
|
60
58
|
}
|
|
61
59
|
.cpub-logo-pub { color: var(--accent); }
|
|
62
60
|
</style>
|
|
63
|
-
|
|
64
|
-
<style>
|
|
65
|
-
/* Switch logos based on data-theme — pure CSS, no JS hydration needed */
|
|
66
|
-
[data-theme="agora"] .cpub-logo-classic,
|
|
67
|
-
[data-theme="agora-dark"] .cpub-logo-classic {
|
|
68
|
-
display: none !important;
|
|
69
|
-
}
|
|
70
|
-
[data-theme="agora"] .cpub-logo-agora,
|
|
71
|
-
[data-theme="agora-dark"] .cpub-logo-agora {
|
|
72
|
-
display: flex !important;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
package/layouts/default.vue
CHANGED
|
@@ -3,6 +3,7 @@ const { user, isAuthenticated, isAdmin, signOut, refreshSession } = useAuth();
|
|
|
3
3
|
const { count: unreadCount, connect: connectNotifications, disconnect: disconnectNotifications } = useNotifications();
|
|
4
4
|
const { count: unreadMessages, connect: connectMessages, disconnect: disconnectMessages } = useMessages();
|
|
5
5
|
const { hubs, learning, video, docs, contests, admin, federation } = useFeatures();
|
|
6
|
+
const { isDark, setDarkMode } = useTheme();
|
|
6
7
|
const { enabledTypeMeta } = useContentTypes();
|
|
7
8
|
const runtimeConfig = useRuntimeConfig();
|
|
8
9
|
const siteName = computed(() => (runtimeConfig.public.siteName as string) || 'CommonPub');
|
|
@@ -112,6 +113,9 @@ const userUsername = computed(() => user.value?.username ?? '');
|
|
|
112
113
|
<NuxtLink :to="`/u/${userUsername}`" class="cpub-dropdown-item" role="menuitem" @click="userMenuOpen = false"><i class="fa-solid fa-user"></i> Profile</NuxtLink>
|
|
113
114
|
<NuxtLink to="/dashboard" class="cpub-dropdown-item" role="menuitem" @click="userMenuOpen = false"><i class="fa-solid fa-gauge"></i> Dashboard</NuxtLink>
|
|
114
115
|
<NuxtLink to="/settings" class="cpub-dropdown-item" role="menuitem" @click="userMenuOpen = false"><i class="fa-solid fa-gear"></i> Settings</NuxtLink>
|
|
116
|
+
<button class="cpub-dropdown-item" role="menuitem" @click="setDarkMode(!isDark)">
|
|
117
|
+
<i :class="isDark ? 'fa-solid fa-sun' : 'fa-solid fa-moon'"></i> {{ isDark ? 'Light mode' : 'Dark mode' }}
|
|
118
|
+
</button>
|
|
115
119
|
<div class="cpub-dropdown-divider" />
|
|
116
120
|
<button class="cpub-dropdown-item" role="menuitem" @click="handleSignOut"><i class="fa-solid fa-right-from-bracket"></i> Sign out</button>
|
|
117
121
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commonpub/layer",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"files": [
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"@commonpub/docs": "0.5.2",
|
|
55
55
|
"@commonpub/auth": "0.5.0",
|
|
56
56
|
"@commonpub/editor": "0.5.0",
|
|
57
|
-
"@commonpub/
|
|
58
|
-
"@commonpub/protocol": "0.9.5",
|
|
57
|
+
"@commonpub/ui": "0.8.3",
|
|
59
58
|
"@commonpub/learning": "0.5.0",
|
|
60
|
-
"@commonpub/
|
|
61
|
-
"@commonpub/schema": "0.8.13"
|
|
59
|
+
"@commonpub/server": "2.22.0",
|
|
60
|
+
"@commonpub/schema": "0.8.13",
|
|
61
|
+
"@commonpub/protocol": "0.9.5"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@testing-library/jest-dom": "^6.9.1",
|
package/pages/settings/index.vue
CHANGED
|
@@ -1,81 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// Redirect bare /settings to /settings/profile on mount
|
|
6
|
-
onMounted(() => {
|
|
7
|
-
const route = useRoute();
|
|
8
|
-
if (route.path === '/settings') {
|
|
9
|
-
navigateTo('/settings/profile', { replace: true });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
2
|
+
// Default child route — redirect to profile
|
|
3
|
+
navigateTo('/settings/profile', { replace: true });
|
|
12
4
|
</script>
|
|
13
5
|
|
|
14
6
|
<template>
|
|
15
|
-
<div
|
|
16
|
-
<div class="cpub-settings-layout">
|
|
17
|
-
<aside class="cpub-settings-nav">
|
|
18
|
-
<h2 class="cpub-sidebar-heading">Settings</h2>
|
|
19
|
-
<nav>
|
|
20
|
-
<NuxtLink to="/settings/profile" class="cpub-settings-link">
|
|
21
|
-
<i class="fa-solid fa-user" style="width: 14px"></i> Profile
|
|
22
|
-
</NuxtLink>
|
|
23
|
-
<NuxtLink to="/settings/account" class="cpub-settings-link">
|
|
24
|
-
<i class="fa-solid fa-shield-halved" style="width: 14px"></i> Account
|
|
25
|
-
</NuxtLink>
|
|
26
|
-
<NuxtLink to="/settings/notifications" class="cpub-settings-link">
|
|
27
|
-
<i class="fa-solid fa-bell" style="width: 14px"></i> Notifications
|
|
28
|
-
</NuxtLink>
|
|
29
|
-
<NuxtLink to="/settings/appearance" class="cpub-settings-link">
|
|
30
|
-
<i class="fa-solid fa-palette" style="width: 14px"></i> Appearance
|
|
31
|
-
</NuxtLink>
|
|
32
|
-
</nav>
|
|
33
|
-
</aside>
|
|
34
|
-
<div class="cpub-settings-content">
|
|
35
|
-
<NuxtPage />
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
7
|
+
<div />
|
|
39
8
|
</template>
|
|
40
|
-
|
|
41
|
-
<style scoped>
|
|
42
|
-
.cpub-settings-layout {
|
|
43
|
-
display: grid;
|
|
44
|
-
grid-template-columns: 200px 1fr;
|
|
45
|
-
gap: 32px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.cpub-settings-nav nav {
|
|
49
|
-
display: flex;
|
|
50
|
-
flex-direction: column;
|
|
51
|
-
gap: 2px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.cpub-settings-link {
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
gap: 8px;
|
|
58
|
-
padding: 6px 10px;
|
|
59
|
-
font-size: 13px;
|
|
60
|
-
color: var(--text-dim);
|
|
61
|
-
text-decoration: none;
|
|
62
|
-
border: var(--border-width-default) solid transparent;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.cpub-settings-link:hover {
|
|
66
|
-
background: var(--surface2);
|
|
67
|
-
color: var(--text);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.cpub-settings-link.router-link-active {
|
|
71
|
-
background: var(--accent-bg);
|
|
72
|
-
border-color: var(--accent-border);
|
|
73
|
-
color: var(--accent);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@media (max-width: 768px) {
|
|
77
|
-
.cpub-settings-layout {
|
|
78
|
-
grid-template-columns: 1fr;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
definePageMeta({ middleware: 'auth' });
|
|
3
|
+
useSeoMeta({ title: `Settings — ${useSiteName()}` });
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div class="cpub-settings-page">
|
|
8
|
+
<div class="cpub-settings-layout">
|
|
9
|
+
<aside class="cpub-settings-nav">
|
|
10
|
+
<h2 class="cpub-sidebar-heading">Settings</h2>
|
|
11
|
+
<nav>
|
|
12
|
+
<NuxtLink to="/settings/profile" class="cpub-settings-link">
|
|
13
|
+
<i class="fa-solid fa-user" style="width: 14px"></i> Profile
|
|
14
|
+
</NuxtLink>
|
|
15
|
+
<NuxtLink to="/settings/account" class="cpub-settings-link">
|
|
16
|
+
<i class="fa-solid fa-shield-halved" style="width: 14px"></i> Account
|
|
17
|
+
</NuxtLink>
|
|
18
|
+
<NuxtLink to="/settings/notifications" class="cpub-settings-link">
|
|
19
|
+
<i class="fa-solid fa-bell" style="width: 14px"></i> Notifications
|
|
20
|
+
</NuxtLink>
|
|
21
|
+
<NuxtLink to="/settings/appearance" class="cpub-settings-link">
|
|
22
|
+
<i class="fa-solid fa-palette" style="width: 14px"></i> Appearance
|
|
23
|
+
</NuxtLink>
|
|
24
|
+
</nav>
|
|
25
|
+
</aside>
|
|
26
|
+
<div class="cpub-settings-content">
|
|
27
|
+
<NuxtPage />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.cpub-settings-layout {
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: 200px 1fr;
|
|
37
|
+
gap: 32px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.cpub-settings-nav nav {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 2px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.cpub-settings-link {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
padding: 6px 10px;
|
|
51
|
+
font-size: 13px;
|
|
52
|
+
color: var(--text-dim);
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
border: var(--border-width-default) solid transparent;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.cpub-settings-link:hover {
|
|
58
|
+
background: var(--surface2);
|
|
59
|
+
color: var(--text);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.cpub-settings-link.router-link-active {
|
|
63
|
+
background: var(--accent-bg);
|
|
64
|
+
border-color: var(--accent-border);
|
|
65
|
+
color: var(--accent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (max-width: 768px) {
|
|
69
|
+
.cpub-settings-layout {
|
|
70
|
+
grid-template-columns: 1fr;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -6,7 +6,7 @@ import { eq } from 'drizzle-orm';
|
|
|
6
6
|
import { instanceSettings } from '@commonpub/schema';
|
|
7
7
|
import { THEME_TO_FAMILY, FAMILY_VARIANTS, IS_DARK, VALID_THEME_IDS } from '../../utils/themeConfig';
|
|
8
8
|
|
|
9
|
-
const CACHE_TTL =
|
|
9
|
+
const CACHE_TTL = 300_000; // 5 minutes — admin changes take up to 5 min to propagate
|
|
10
10
|
|
|
11
11
|
let cached: string | null = null;
|
|
12
12
|
let cacheTime = 0;
|
package/theme/agora-dark.css
CHANGED
|
@@ -357,3 +357,7 @@
|
|
|
357
357
|
[data-theme="agora-dark"] [data-content-type="explainer"] { --badge-color: #3dbcab; --badge-bg: rgba(61, 188, 171, 0.12); }
|
|
358
358
|
[data-theme="agora-dark"] [data-content-type="video"] { --badge-color: #d85e55; --badge-bg: rgba(216, 94, 85, 0.12); }
|
|
359
359
|
[data-theme="agora-dark"] [data-content-type="tutorial"] { --badge-color: #daa040; --badge-bg: rgba(218, 160, 64, 0.12); }
|
|
360
|
+
|
|
361
|
+
/* Logo switch */
|
|
362
|
+
[data-theme="agora-dark"] .cpub-logo-classic { display: none !important; }
|
|
363
|
+
[data-theme="agora-dark"] .cpub-logo-agora { display: flex !important; }
|
package/theme/agora.css
CHANGED
|
@@ -460,3 +460,13 @@
|
|
|
460
460
|
[data-theme="agora"] [data-content-type="explainer"] { --badge-color: #2a9d8f; --badge-bg: rgba(42, 157, 143, 0.08); }
|
|
461
461
|
[data-theme="agora"] [data-content-type="video"] { --badge-color: #c4443a; --badge-bg: rgba(196, 68, 58, 0.08); }
|
|
462
462
|
[data-theme="agora"] [data-content-type="tutorial"] { --badge-color: #c4882a; --badge-bg: rgba(196, 136, 42, 0.08); }
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
/* ═══════════════════════════════════════════
|
|
466
|
+
LOGO SWITCH
|
|
467
|
+
Hide Classic logo, show Agora Town Square
|
|
468
|
+
mark + Fraunces wordmark.
|
|
469
|
+
═══════════════════════════════════════════ */
|
|
470
|
+
|
|
471
|
+
[data-theme="agora"] .cpub-logo-classic { display: none !important; }
|
|
472
|
+
[data-theme="agora"] .cpub-logo-agora { display: flex !important; }
|