Small fixes

This commit is contained in:
DrMint 2024-03-09 23:49:48 +01:00
parent 13540a651a
commit 612e92df82
6 changed files with 33 additions and 6 deletions

View File

@ -20,7 +20,7 @@ export default defineConfig({
}, },
}), }),
], ],
devToolbar: { enabled: false }, // devToolbar: { enabled: false },
server: { server: {
port: 12499, port: 12499,
host: true, host: true,

View File

@ -33,6 +33,8 @@ const uniqueId = getRandomId();
object-fit: cover; object-fit: cover;
object-position: 50% 0; object-position: 50% 0;
z-index: -1;
mask-image: linear-gradient(to bottom, rgba(0 0 0 / 30%) 0%, transparent 100%); mask-image: linear-gradient(to bottom, rgba(0 0 0 / 30%) 0%, transparent 100%);
@media (min-width: 110vh) { @media (min-width: 110vh) {

View File

@ -35,8 +35,8 @@ const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
} }
<div id="toolbar" class="hide-scrollbar"> <div id="toolbar" class="hide-scrollbar">
<a href={getLocalizedUrl("/search")}> <a href={getLocalizedUrl("/search")} aria-label={t("header.topbar.search.tooltip")}>
<Button icon="material-symbols:search" ariaLabel={t("header.topbar.search.tooltip")} /> <Button icon="material-symbols:search" />
</a> </a>
<div class="separator"></div> <div class="separator"></div>

View File

@ -20,7 +20,7 @@ switch (collectionSlug) {
break; break;
case Collections.Languages: case Collections.Languages:
await refreshLocales() await refreshLocales();
break; break;
default: default:

View File

@ -19,9 +19,9 @@ export const refreshWordings = async () => {
}; };
export const refreshCurrencies = async () => { export const refreshCurrencies = async () => {
cache.currencies = (await payload.getCurrencies()).map(({ id }) => id) cache.currencies = (await payload.getCurrencies()).map(({ id }) => id);
}; };
export const refreshLocales = async () => { export const refreshLocales = async () => {
cache.locales = await payload.getLanguages(); cache.locales = await payload.getLanguages();
}; };

View File

@ -1,3 +1,11 @@
import {
isNodeLinkNode,
isNodeListNode,
isNodeParagraphNode,
isNodeTextNode,
type RichTextContent,
type RichTextNode,
} from "src/shared/payload/payload-sdk";
import { cache } from "src/utils/cachedPayload"; import { cache } from "src/utils/cachedPayload";
export const formatLocale = (code: string): string => export const formatLocale = (code: string): string =>
@ -22,3 +30,20 @@ export const formatInlineTitle = ({
} }
return result; return result;
}; };
export const formatRichTextToString = (content: RichTextContent): string => {
const formatNode = (node: RichTextNode): string => {
if (isNodeParagraphNode(node)) {
return node.children.map(formatNode).join("");
} else if (isNodeListNode(node)) {
return "LIST";
} else if (isNodeTextNode(node)) {
return node.text;
} else if (isNodeLinkNode(node)) {
return node.children.map(formatNode).join("");
}
return "";
};
return content.root.children.map(formatNode).join("\n\n");
};