Skip to content

chore: Merge branch dev to main #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
%sveltekit.head%
</head>

<body>
<body style="background-color: var(--background-one)">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
3 changes: 1 addition & 2 deletions src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
transition:
color 0.5s ease-in-out,
background-color 0.5s ease-in-out,
background-color 20s ease-in-out,
fill 0.5s ease-in-out;
}

Expand All @@ -23,7 +23,6 @@ html {
body {
margin: 0;
padding: 0;
background-color: var(--background-one);
}

html,
Expand Down
6 changes: 2 additions & 4 deletions src/data/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export function api_base_url(): string {
if (browser) {
const apiUrl = localStorage.getItem(URL_KEY) || default_api_url;

set_about_info(apiUrl);

return apiUrl;
}

Expand Down Expand Up @@ -46,11 +44,11 @@ export function set_api_base_url(url?: string) {
localStorage.removeItem(URL_KEY);
} else {
localStorage.setItem(URL_KEY, url);
set_about_info(url);
}
set_about_info(api_base_url());
}

function set_about_info(apiUrl: string) {
export function set_about_info(apiUrl: string) {
if (!localStorage.getItem(STATUS_KEY) || !localStorage.getItem(EMAIL_KEY)) {
fetch(`${apiUrl}/v4/about`)
.then((response) => (response.ok ? response.json() : null))
Expand Down
1 change: 0 additions & 1 deletion src/layout/Footer/FooterHost.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@

<style lang="scss">
footer {
background-color: var(--background-one);
max-width: min(87%, 100rem);
padding: 5rem 0rem;
margin: 0 auto;
Expand Down
4 changes: 3 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import { events as themeEvents } from '$util/themeEvents';

import FooterHost from '$layout/Footer/FooterHost.svelte';
import { api_base_url, set_about_info } from '$data/api/settings';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -50,7 +51,8 @@
);

onMount(() => {
new DateTriggerEventHandler(themeEvents);
set_about_info(api_base_url());
// new DateTriggerEventHandler(themeEvents);

isRestoring.set(true);
const [unsubscribe, promise] = persistQueryClient({
Expand Down
13 changes: 12 additions & 1 deletion src/routes/announcements/[slug]/AdminButtons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import Show from 'svelte-material-icons/EyeOutline.svelte';
import Hide from 'svelte-material-icons/EyeOffOutline.svelte';
import Unarchive from 'svelte-material-icons/ArchiveArrowUpOutline.svelte';
import { formatUTC } from '$util/formatUtc';

export let isEditing: boolean;
export let isCreating: boolean;
Expand Down Expand Up @@ -67,6 +68,11 @@
const save = async () => {
if (!isValid()) return;

Object.assign(draftInputs, {
created_at: formatUTC(draftInputs.created_at),
archived_at: formatUTC(draftInputs.archived_at)
});

await admin.update_announcement(announcementIdNumber!, sanitize(draftInputs));
await $query?.refetch();

Expand All @@ -76,8 +82,13 @@
const createAnnouncement = async () => {
if (!isValid()) return;

Object.assign(draftInputs, {
created_at: formatUTC(draftInputs.created_at),
archived_at: formatUTC(draftInputs.archived_at)
});

await admin.create_announcement(sanitize(draftInputs));
await client.invalidateQueries(queries['announcements']());
await client.invalidateQueries(queries.announcements());
goto('/announcements', { invalidateAll: true });
};

Expand Down
3 changes: 3 additions & 0 deletions src/util/formatUtc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import moment from 'moment';

export const formatUTC = (d: any) => d && moment(d).utc().format('YYYY-MM-DDTHH:mm[Z]');