Upgraded dependencies, bumped to Node 24.
This commit is contained in:
@@ -1,3 +1,64 @@
|
||||
<script setup>
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
import {
|
||||
computed,
|
||||
inject,
|
||||
ref,
|
||||
useId,
|
||||
} from 'vue';
|
||||
|
||||
import AlertDialog from '#/components/alerts/create.vue';
|
||||
import Notifications from '#/components/header/notifications.vue';
|
||||
import Settings from '#/components/settings/settings.vue';
|
||||
// import getPath from '#/src/get-path.js';
|
||||
|
||||
import { del } from '#/src/api.js';
|
||||
import events from '#/src/events.js';
|
||||
import navigate from '#/src/navigate.js';
|
||||
|
||||
import logo from '../../assets/img/logo.svg?raw';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const theme = ref(pageContext.env.theme);
|
||||
|
||||
const user = pageContext.user;
|
||||
const primaryStash = pageContext.assets?.primaryStash;
|
||||
const unseen = ref(pageContext.assets?.unseenNotifications);
|
||||
const query = ref(pageContext.urlParsed.search.q || '');
|
||||
const allowLogin = pageContext.env.allowLogin;
|
||||
const searchFocused = ref(false);
|
||||
const showSettings = ref(false);
|
||||
const showAlertDialog = ref(false);
|
||||
const notifsDropdownId = useId();
|
||||
const menuDropdownId = useId();
|
||||
|
||||
const activePage = computed(() => pageContext.urlParsed.pathname.split('/')[1]);
|
||||
const currentPath = `${pageContext.urlParsed.pathnameOriginal}${pageContext.urlParsed.searchOriginal || ''}`;
|
||||
|
||||
function search() {
|
||||
navigate('/search', { q: query.value }, { redirect: true });
|
||||
}
|
||||
|
||||
function setTheme(newTheme) {
|
||||
theme.value = newTheme;
|
||||
|
||||
Cookies.set('theme', newTheme);
|
||||
events.emit('theme', newTheme);
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
await del('/session');
|
||||
navigate('/login?consent', null, { redirect: true }); // pass consent variable to reinstate in new session
|
||||
}
|
||||
|
||||
function blurSearch(event) {
|
||||
if (!event.relatedTarget || !Object.hasOwn(event.relatedTarget?.dataset, 'search')) {
|
||||
searchFocused.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="header">
|
||||
<nav class="nav">
|
||||
@@ -92,6 +153,7 @@
|
||||
>
|
||||
<VDropdown
|
||||
v-if="user"
|
||||
:aria-id="notifsDropdownId"
|
||||
:triggers="['click']"
|
||||
:prevent-overflow="true"
|
||||
class="notifs-trigger"
|
||||
@@ -121,6 +183,7 @@
|
||||
</VDropdown>
|
||||
|
||||
<VDropdown
|
||||
:aria-id="menuDropdownId"
|
||||
:triggers="['click']"
|
||||
:prevent-overflow="true"
|
||||
class="menu-trigger"
|
||||
@@ -283,64 +346,6 @@
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
inject,
|
||||
} from 'vue';
|
||||
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
import navigate from '#/src/navigate.js';
|
||||
import { del } from '#/src/api.js';
|
||||
import events from '#/src/events.js';
|
||||
// import getPath from '#/src/get-path.js';
|
||||
|
||||
import Notifications from '#/components/header/notifications.vue';
|
||||
import Settings from '#/components/settings/settings.vue';
|
||||
import AlertDialog from '#/components/alerts/create.vue';
|
||||
|
||||
import logo from '../../assets/img/logo.svg?raw'; // eslint-disable-line import/no-unresolved
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const theme = ref(pageContext.env.theme);
|
||||
|
||||
const user = pageContext.user;
|
||||
const primaryStash = pageContext.assets?.primaryStash;
|
||||
const unseen = ref(pageContext.assets?.unseenNotifications);
|
||||
const query = ref(pageContext.urlParsed.search.q || '');
|
||||
const allowLogin = pageContext.env.allowLogin;
|
||||
const searchFocused = ref(false);
|
||||
const showSettings = ref(false);
|
||||
const showAlertDialog = ref(false);
|
||||
|
||||
const activePage = computed(() => pageContext.urlParsed.pathname.split('/')[1]);
|
||||
const currentPath = `${pageContext.urlParsed.pathnameOriginal}${pageContext.urlParsed.searchOriginal || ''}`;
|
||||
|
||||
function search() {
|
||||
navigate('/search', { q: query.value }, { redirect: true });
|
||||
}
|
||||
|
||||
function setTheme(newTheme) {
|
||||
theme.value = newTheme;
|
||||
|
||||
Cookies.set('theme', newTheme);
|
||||
events.emit('theme', newTheme);
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
await del('/session');
|
||||
navigate('/login?consent', null, { redirect: true }); // pass consent variable to reinstate in new session
|
||||
}
|
||||
|
||||
function blurSearch(event) {
|
||||
if (!event.relatedTarget || !Object.hasOwn(event.relatedTarget?.dataset, 'search')) {
|
||||
searchFocused.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.header {
|
||||
display: flex;
|
||||
|
||||
@@ -1,3 +1,67 @@
|
||||
<script setup>
|
||||
import {
|
||||
defineEmits,
|
||||
inject,
|
||||
onMounted,
|
||||
ref,
|
||||
} from 'vue';
|
||||
|
||||
import Ellipsis from '#/components/loading/ellipsis.vue';
|
||||
import { get, patch } from '#/src/api.js';
|
||||
|
||||
import { formatDate } from '#/utils/format.js';
|
||||
|
||||
const emit = defineEmits(['unseen', 'addAlert']);
|
||||
const pageContext = inject('pageContext');
|
||||
const user = pageContext.user;
|
||||
|
||||
const notifications = ref([]);
|
||||
const done = ref(true);
|
||||
|
||||
async function fetchNotifications() {
|
||||
done.value = false;
|
||||
|
||||
const res = await get(`/users/${user?.id}/notifications`);
|
||||
notifications.value = res.notifications;
|
||||
|
||||
done.value = true;
|
||||
|
||||
emit('unseen', res.unseen);
|
||||
}
|
||||
|
||||
async function markSeen(notif) {
|
||||
if (notif.isSeen || !done.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
done.value = false;
|
||||
|
||||
await patch(`/users/${user?.id}/notifications/${notif.id}`, {
|
||||
seen: true,
|
||||
});
|
||||
|
||||
await fetchNotifications();
|
||||
|
||||
done.value = true;
|
||||
}
|
||||
|
||||
async function markAllSeen() {
|
||||
done.value = false;
|
||||
|
||||
await patch(`/users/${user?.id}/notifications`, {
|
||||
seen: true,
|
||||
});
|
||||
|
||||
await fetchNotifications();
|
||||
|
||||
done.value = true;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchNotifications();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="menu">
|
||||
<div class="notifs-header">
|
||||
@@ -88,71 +152,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
defineEmits,
|
||||
onMounted,
|
||||
inject,
|
||||
} from 'vue';
|
||||
|
||||
import { get, patch } from '#/src/api.js';
|
||||
import { formatDate } from '#/utils/format.js';
|
||||
|
||||
import Ellipsis from '#/components/loading/ellipsis.vue';
|
||||
|
||||
const pageContext = inject('pageContext');
|
||||
const user = pageContext.user;
|
||||
|
||||
const notifications = ref([]);
|
||||
const done = ref(true);
|
||||
|
||||
const emit = defineEmits(['unseen', 'addAlert']);
|
||||
|
||||
async function fetchNotifications() {
|
||||
done.value = false;
|
||||
|
||||
const res = await get(`/users/${user?.id}/notifications`);
|
||||
notifications.value = res.notifications;
|
||||
|
||||
done.value = true;
|
||||
|
||||
emit('unseen', res.unseen);
|
||||
}
|
||||
|
||||
async function markSeen(notif) {
|
||||
if (notif.isSeen || !done.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
done.value = false;
|
||||
|
||||
await patch(`/users/${user?.id}/notifications/${notif.id}`, {
|
||||
seen: true,
|
||||
});
|
||||
|
||||
await fetchNotifications();
|
||||
|
||||
done.value = true;
|
||||
}
|
||||
|
||||
async function markAllSeen() {
|
||||
done.value = false;
|
||||
|
||||
await patch(`/users/${user?.id}/notifications`, {
|
||||
seen: true,
|
||||
});
|
||||
|
||||
await fetchNotifications();
|
||||
|
||||
done.value = true;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchNotifications();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.notifs {
|
||||
width: 30rem;
|
||||
|
||||
Reference in New Issue
Block a user