Added missing search preview types
This commit is contained in:
parent
f94d6b24ab
commit
0cf71b4d95
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
import GenericPreview from "components/Previews/GenericPreview.astro";
|
||||
import { getI18n } from "src/i18n/i18n";
|
||||
import type { EndpointChronologyEvent } from "src/shared/payload/payload-sdk";
|
||||
import { formatRichTextToString, formatTimelineDateToId } from "src/utils/format";
|
||||
|
||||
interface Props {
|
||||
event: EndpointChronologyEvent["events"][number];
|
||||
date: EndpointChronologyEvent["date"];
|
||||
}
|
||||
|
||||
const { getLocalizedUrl, getLocalizedMatch, t, formatTimelineDate } = await getI18n(
|
||||
Astro.locals.currentLocale
|
||||
);
|
||||
|
||||
const {
|
||||
date,
|
||||
event: { translations },
|
||||
} = Astro.props;
|
||||
|
||||
const { title, description, language } = getLocalizedMatch(translations);
|
||||
|
||||
const getTruncatedText = () => {
|
||||
const getTextContent = () => {
|
||||
if (title) return title;
|
||||
if (description) return formatRichTextToString(description);
|
||||
return "";
|
||||
};
|
||||
|
||||
const text = getTextContent();
|
||||
const limit = 45;
|
||||
const truncationMark = "...";
|
||||
if (text.length < limit) return text;
|
||||
return text.substring(0, limit - truncationMark.length) + truncationMark;
|
||||
};
|
||||
---
|
||||
|
||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||
|
||||
<GenericPreview
|
||||
lang={language}
|
||||
pretitle={formatTimelineDate(date)}
|
||||
title={getTruncatedText()}
|
||||
href={getLocalizedUrl(`/timeline#${formatTimelineDateToId(date)}`)}
|
||||
icon="material-symbols:calendar-month"
|
||||
iconHoverLabel={t("global.collections.chronologyEvents", { count: 1 })}
|
||||
smallTitle
|
||||
/>
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
import GenericPreview from "components/Previews/GenericPreview.astro";
|
||||
import { getI18n } from "src/i18n/i18n";
|
||||
import type { EndpointFolder } from "src/shared/payload/payload-sdk";
|
||||
import type { Attribute } from "src/utils/attributes";
|
||||
|
||||
interface Props {
|
||||
folder: EndpointFolder;
|
||||
}
|
||||
|
||||
const { getLocalizedUrl, getLocalizedMatch, t } = await getI18n(
|
||||
Astro.locals.currentLocale
|
||||
);
|
||||
|
||||
const {
|
||||
folder: { translations, slug, files, sections, parentPages },
|
||||
} = Astro.props;
|
||||
|
||||
const { language, title } = getLocalizedMatch(translations);
|
||||
|
||||
const fileCount = files.length;
|
||||
|
||||
const subfolderCount =
|
||||
sections.type === "single"
|
||||
? sections.subfolders.length
|
||||
: sections.sections.reduce((acc, section) => acc + section.subfolders.length, 0);
|
||||
|
||||
const attributes: Attribute[] = [
|
||||
{
|
||||
icon: "material-symbols:box",
|
||||
title: t("global.folders.attributes.content.label"),
|
||||
values: [{ name: t("global.folders.attributes.content.value", { fileCount, subfolderCount }) }],
|
||||
},
|
||||
{
|
||||
icon: "material-symbols:keyboard-return",
|
||||
title: t("global.folders.attributes.parent"),
|
||||
values: parentPages.flatMap((parent) => {
|
||||
if (parent.type !== "folder") return [];
|
||||
const name = getLocalizedMatch(parent.folder.translations).title;
|
||||
return { name };
|
||||
}),
|
||||
},
|
||||
];
|
||||
---
|
||||
|
||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||
|
||||
<GenericPreview
|
||||
title={title}
|
||||
lang={language}
|
||||
href={getLocalizedUrl(`/folders/${slug}`)}
|
||||
attributes={attributes}
|
||||
icon="material-symbols:folder-open"
|
||||
iconHoverLabel={t("global.collections.folders", { count: 1 })}
|
||||
smallTitle
|
||||
/>
|
|
@ -113,8 +113,18 @@ for (const attribute of attributes) {
|
|||
<div id="footer">
|
||||
{
|
||||
smallTitle ? (
|
||||
<p class="font-l" lang={lang}>
|
||||
{title}
|
||||
<p lang={lang}>
|
||||
{pretitle && (
|
||||
<span id="pretitle" class="font-s">
|
||||
{pretitle}
|
||||
</span>
|
||||
)}
|
||||
<span class="font-l">{title}</span>
|
||||
{subtitle && (
|
||||
<span id="subtitle" class="font-m">
|
||||
{subtitle}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
) : (
|
||||
<p lang={lang}>
|
||||
|
@ -137,9 +147,7 @@ for (const attribute of attributes) {
|
|||
clippedAttributes.length > 0 && (
|
||||
<>
|
||||
{subtitle && <hr />}
|
||||
<div id="tags">
|
||||
<InlineAttributes attributes={clippedAttributes} />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
import GenericPreview from "components/Previews/GenericPreview.astro";
|
||||
import { getI18n } from "src/i18n/i18n";
|
||||
import type { EndpointRecorder } from "src/shared/payload/payload-sdk";
|
||||
import type { Attribute } from "src/utils/attributes";
|
||||
import { formatLocale } from "src/utils/format";
|
||||
|
||||
interface Props {
|
||||
recorder: EndpointRecorder;
|
||||
}
|
||||
|
||||
const { getLocalizedUrl, t } = await getI18n(Astro.locals.currentLocale);
|
||||
|
||||
const {
|
||||
recorder: { id, languages, username, avatar },
|
||||
} = Astro.props;
|
||||
|
||||
const attributes: Attribute[] = [
|
||||
{
|
||||
icon: "material-symbols:translate",
|
||||
title: t("collectibles.languages"),
|
||||
values: languages.map((id) => ({ name: formatLocale(id) })),
|
||||
},
|
||||
];
|
||||
---
|
||||
|
||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||
|
||||
<GenericPreview
|
||||
title={username}
|
||||
thumbnail={avatar}
|
||||
href={getLocalizedUrl(`/recorders/${id}`)}
|
||||
attributes={attributes}
|
||||
icon="material-symbols:person"
|
||||
iconHoverLabel={t("global.collections.recorders", { count: 1 })}
|
||||
/>
|
|
@ -173,4 +173,7 @@ export type WordingKey =
|
|||
| "paginator.goFirstPageButton"
|
||||
| "paginator.goPreviousPageButton"
|
||||
| "paginator.goNextPageButton"
|
||||
| "paginator.goLastPageButton";
|
||||
| "paginator.goLastPageButton"
|
||||
| "global.folders.attributes.content.label"
|
||||
| "global.folders.attributes.content.value"
|
||||
| "global.folders.attributes.parent";
|
||||
|
|
|
@ -153,7 +153,7 @@ const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
|
|||
}
|
||||
|
||||
& > a {
|
||||
width: fit-content
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
& > p {
|
||||
|
@ -162,7 +162,6 @@ const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
|
|||
}
|
||||
|
||||
&#library {
|
||||
|
||||
& > .grid {
|
||||
@media (max-width: 40rem) {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
|
|
|
@ -14,6 +14,9 @@ import Button from "components/Button.astro";
|
|||
import Paginator from "./_components/Paginator.astro";
|
||||
import { Icon } from "astro-icon/components";
|
||||
import HomeTitle from "../_components/HomeTitle.astro";
|
||||
import RecorderPreview from "components/Previews/RecorderPreview.astro";
|
||||
import FolderPreview from "components/Previews/FolderPreview.astro";
|
||||
import ChronologyEventPreview from "components/Previews/ChronologyEventPreview.astro";
|
||||
|
||||
type State = {
|
||||
q: string;
|
||||
|
@ -169,8 +172,14 @@ const getSearchUrl = (newState: State): string => {
|
|||
return <ImagePreview image={data} />;
|
||||
|
||||
case Collections.Recorders:
|
||||
return <RecorderPreview recorder={data} />;
|
||||
|
||||
case Collections.Folders:
|
||||
return <FolderPreview folder={data} />;
|
||||
|
||||
case Collections.ChronologyEvents:
|
||||
return <ChronologyEventPreview event={data.event} date={data.date} />;
|
||||
|
||||
default:
|
||||
return <ErrorMessage title={`Unsupported result type: ${type}`} />;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,10 @@ export type MeiliDocument = {
|
|||
}
|
||||
| {
|
||||
type: Collections.ChronologyEvents;
|
||||
data: EndpointChronologyEvent;
|
||||
data: {
|
||||
date: EndpointChronologyEvent["date"];
|
||||
event: EndpointChronologyEvent["events"][number];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1,177 +1,177 @@
|
|||
{
|
||||
"disclaimer": "Usage subject to terms: https://openexchangerates.org/terms",
|
||||
"license": "https://openexchangerates.org/license",
|
||||
"timestamp": 1720674000,
|
||||
"timestamp": 1720861211,
|
||||
"base": "USD",
|
||||
"rates": {
|
||||
"AED": 3.672995,
|
||||
"AFN": 70.982926,
|
||||
"ALL": 92.598068,
|
||||
"AMD": 387.544052,
|
||||
"ANG": 1.8,
|
||||
"AOA": 873.383333,
|
||||
"ARS": 918.7543,
|
||||
"AUD": 1.479787,
|
||||
"AWG": 1.80125,
|
||||
"AED": 3.67297,
|
||||
"AFN": 70.829596,
|
||||
"ALL": 92.094295,
|
||||
"AMD": 388.376588,
|
||||
"ANG": 1.799437,
|
||||
"AOA": 875.5,
|
||||
"ARS": 918.5853,
|
||||
"AUD": 1.477978,
|
||||
"AWG": 1.8015,
|
||||
"AZN": 1.7,
|
||||
"BAM": 1.805093,
|
||||
"BAM": 1.799314,
|
||||
"BBD": 2,
|
||||
"BDT": 117.352266,
|
||||
"BGN": 1.804615,
|
||||
"BHD": 0.37684,
|
||||
"BIF": 2875.028244,
|
||||
"BDT": 117.502271,
|
||||
"BGN": 1.79346,
|
||||
"BHD": 0.376597,
|
||||
"BIF": 2874.488982,
|
||||
"BMD": 1,
|
||||
"BND": 1.348125,
|
||||
"BOB": 6.901771,
|
||||
"BRL": 5.4162,
|
||||
"BND": 1.345115,
|
||||
"BOB": 6.909058,
|
||||
"BRL": 5.4292,
|
||||
"BSD": 1,
|
||||
"BTC": 0.000017315845,
|
||||
"BTN": 83.415626,
|
||||
"BWP": 13.50623,
|
||||
"BYN": 3.268574,
|
||||
"BZD": 2.013198,
|
||||
"CAD": 1.3622,
|
||||
"CDF": 2841.540041,
|
||||
"CHF": 0.899276,
|
||||
"CLF": 0.033091,
|
||||
"CLP": 913.09,
|
||||
"CNH": 7.287038,
|
||||
"CNY": 7.271,
|
||||
"COP": 4006.458354,
|
||||
"CRC": 533.089606,
|
||||
"BTC": 0.00001724872,
|
||||
"BTN": 83.39403,
|
||||
"BWP": 13.466464,
|
||||
"BYN": 3.266865,
|
||||
"BZD": 2.012487,
|
||||
"CAD": 1.36465,
|
||||
"CDF": 2867.5,
|
||||
"CHF": 0.895215,
|
||||
"CLF": 0.03299,
|
||||
"CLP": 905.89,
|
||||
"CNH": 7.27771,
|
||||
"CNY": 7.2504,
|
||||
"COP": 3963.67177,
|
||||
"CRC": 521.852449,
|
||||
"CUC": 1,
|
||||
"CUP": 25.75,
|
||||
"CVE": 101.768343,
|
||||
"CZK": 23.434457,
|
||||
"DJF": 177.830332,
|
||||
"DKK": 6.883955,
|
||||
"DOP": 58.985038,
|
||||
"DZD": 134.512,
|
||||
"EGP": 47.998,
|
||||
"CVE": 101.875,
|
||||
"CZK": 23.2206,
|
||||
"DJF": 177.5,
|
||||
"DKK": 6.8409,
|
||||
"DOP": 59.015517,
|
||||
"DZD": 134.325493,
|
||||
"EGP": 47.974539,
|
||||
"ERN": 15,
|
||||
"ETB": 57.693207,
|
||||
"EUR": 0.922811,
|
||||
"FJD": 2.2569,
|
||||
"FKP": 0.777738,
|
||||
"GBP": 0.777738,
|
||||
"GEL": 2.745,
|
||||
"GGP": 0.777738,
|
||||
"GHS": 15.355933,
|
||||
"GIP": 0.777738,
|
||||
"GMD": 67.775,
|
||||
"GNF": 8598.104804,
|
||||
"GTQ": 7.757446,
|
||||
"GYD": 208.954363,
|
||||
"HKD": 7.809765,
|
||||
"HNL": 24.737539,
|
||||
"HRK": 6.952992,
|
||||
"HTG": 132.035075,
|
||||
"HUF": 363.126953,
|
||||
"IDR": 16200.75,
|
||||
"ILS": 3.64997,
|
||||
"IMP": 0.777738,
|
||||
"INR": 83.508352,
|
||||
"IQD": 1308.365065,
|
||||
"IRR": 42100,
|
||||
"ISK": 137.6,
|
||||
"JEP": 0.777738,
|
||||
"JMD": 156.687354,
|
||||
"ETB": 57.680635,
|
||||
"EUR": 0.915625,
|
||||
"FJD": 2.2208,
|
||||
"FKP": 0.770475,
|
||||
"GBP": 0.770475,
|
||||
"GEL": 2.73,
|
||||
"GGP": 0.770475,
|
||||
"GHS": 15.41,
|
||||
"GIP": 0.770475,
|
||||
"GMD": 67.75,
|
||||
"GNF": 8595.1494,
|
||||
"GTQ": 7.762935,
|
||||
"GYD": 209.09875,
|
||||
"HKD": 7.80815,
|
||||
"HNL": 24.72931,
|
||||
"HRK": 6.90795,
|
||||
"HTG": 131.964253,
|
||||
"HUF": 359.207038,
|
||||
"IDR": 16114.55,
|
||||
"ILS": 3.612735,
|
||||
"IMP": 0.770475,
|
||||
"INR": 83.518236,
|
||||
"IQD": 1309.830026,
|
||||
"IRR": 42087.5,
|
||||
"ISK": 136.88,
|
||||
"JEP": 0.770475,
|
||||
"JMD": 156.537319,
|
||||
"JOD": 0.7087,
|
||||
"JPY": 161.68767475,
|
||||
"KES": 127.347704,
|
||||
"KGS": 85.4889,
|
||||
"KHR": 4105.179561,
|
||||
"KMF": 454.950092,
|
||||
"JPY": 157.845,
|
||||
"KES": 129,
|
||||
"KGS": 85.3,
|
||||
"KHR": 4099.068562,
|
||||
"KMF": 454.150242,
|
||||
"KPW": 900,
|
||||
"KRW": 1379.280907,
|
||||
"KWD": 0.306002,
|
||||
"KYD": 0.83231,
|
||||
"KZT": 477.300548,
|
||||
"LAK": 22104.308735,
|
||||
"LBP": 89439.5015,
|
||||
"LKR": 303.710191,
|
||||
"LRD": 194.159615,
|
||||
"LSL": 18.05833,
|
||||
"LYD": 4.845386,
|
||||
"MAD": 9.833409,
|
||||
"MDL": 17.698201,
|
||||
"MGA": 4494.7241,
|
||||
"MKD": 56.86716,
|
||||
"KRW": 1375.1,
|
||||
"KWD": 0.30578,
|
||||
"KYD": 0.833219,
|
||||
"KZT": 473.654208,
|
||||
"LAK": 22138.882931,
|
||||
"LBP": 89406.331549,
|
||||
"LKR": 302.451162,
|
||||
"LRD": 194.695295,
|
||||
"LSL": 17.960925,
|
||||
"LYD": 4.842628,
|
||||
"MAD": 9.81451,
|
||||
"MDL": 17.642151,
|
||||
"MGA": 4464.955799,
|
||||
"MKD": 56.406141,
|
||||
"MMK": 2203.340001,
|
||||
"MNT": 3450,
|
||||
"MOP": 8.035423,
|
||||
"MRU": 39.510104,
|
||||
"MUR": 46.899999,
|
||||
"MVR": 15.45,
|
||||
"MWK": 1731.883446,
|
||||
"MXN": 17.831011,
|
||||
"MYR": 4.688,
|
||||
"MOP": 8.040857,
|
||||
"MRU": 39.72,
|
||||
"MUR": 46.680002,
|
||||
"MVR": 15.46,
|
||||
"MWK": 1731.234794,
|
||||
"MXN": 17.620801,
|
||||
"MYR": 4.692,
|
||||
"MZN": 63.899991,
|
||||
"NAD": 18.058496,
|
||||
"NAD": 17.987146,
|
||||
"NGN": 1406,
|
||||
"NIO": 36.760329,
|
||||
"NOK": 10.704123,
|
||||
"NPR": 133.464355,
|
||||
"NZD": 1.640433,
|
||||
"OMR": 0.384954,
|
||||
"NIO": 36.755033,
|
||||
"NOK": 10.7223,
|
||||
"NPR": 133.431752,
|
||||
"NZD": 1.63372,
|
||||
"OMR": 0.38496,
|
||||
"PAB": 1,
|
||||
"PEN": 3.781484,
|
||||
"PGK": 3.905861,
|
||||
"PHP": 58.2915,
|
||||
"PKR": 278.156175,
|
||||
"PLN": 3.933952,
|
||||
"PYG": 7525.707267,
|
||||
"QAR": 3.640365,
|
||||
"RON": 4.5896,
|
||||
"RSD": 108.003,
|
||||
"RUB": 88.348822,
|
||||
"RWF": 1307.15479,
|
||||
"SAR": 3.750761,
|
||||
"SBD": 8.421389,
|
||||
"SCR": 13.773472,
|
||||
"PEN": 3.759996,
|
||||
"PGK": 3.90654,
|
||||
"PHP": 58.413497,
|
||||
"PKR": 277.958449,
|
||||
"PLN": 3.90027,
|
||||
"PYG": 7528.009851,
|
||||
"QAR": 3.64125,
|
||||
"RON": 4.5572,
|
||||
"RSD": 107.291,
|
||||
"RUB": 87.803767,
|
||||
"RWF": 1308.020546,
|
||||
"SAR": 3.750791,
|
||||
"SBD": 8.43942,
|
||||
"SCR": 13.954,
|
||||
"SDG": 601,
|
||||
"SEK": 10.541463,
|
||||
"SGD": 1.34792,
|
||||
"SHP": 0.777738,
|
||||
"SEK": 10.66064,
|
||||
"SGD": 1.3416,
|
||||
"SHP": 0.770475,
|
||||
"SLL": 20969.5,
|
||||
"SOS": 570.837667,
|
||||
"SRD": 29.7815,
|
||||
"SOS": 570.627284,
|
||||
"SRD": 29.712,
|
||||
"SSP": 130.26,
|
||||
"STD": 22281.8,
|
||||
"STN": 22.611906,
|
||||
"SVC": 8.739351,
|
||||
"STN": 22.75,
|
||||
"SVC": 8.75023,
|
||||
"SYP": 2512.53,
|
||||
"SZL": 18.054453,
|
||||
"THB": 36.255,
|
||||
"TJS": 10.636923,
|
||||
"TMT": 3.51,
|
||||
"TND": 3.109297,
|
||||
"TOP": 2.355339,
|
||||
"TRY": 32.910977,
|
||||
"TTD": 6.777174,
|
||||
"TWD": 32.5223,
|
||||
"TZS": 2651.670588,
|
||||
"UAH": 40.704384,
|
||||
"UGX": 3700.104144,
|
||||
"SZL": 17.969617,
|
||||
"THB": 36.147965,
|
||||
"TJS": 10.648579,
|
||||
"TMT": 3.5,
|
||||
"TND": 3.1275,
|
||||
"TOP": 2.356469,
|
||||
"TRY": 33.0504,
|
||||
"TTD": 6.786944,
|
||||
"TWD": 32.5333,
|
||||
"TZS": 2675.731,
|
||||
"UAH": 40.954957,
|
||||
"UGX": 3699.224291,
|
||||
"USD": 1,
|
||||
"UYU": 39.934447,
|
||||
"UZS": 12614.596352,
|
||||
"VES": 36.467683,
|
||||
"VND": 25422.651993,
|
||||
"UYU": 40.038192,
|
||||
"UZS": 12653.245019,
|
||||
"VES": 36.478534,
|
||||
"VND": 25416.190524,
|
||||
"VUV": 118.722,
|
||||
"WST": 2.8,
|
||||
"XAF": 605.324622,
|
||||
"XAG": 0.03221385,
|
||||
"XAU": 0.00041981,
|
||||
"XAF": 600.610733,
|
||||
"XAG": 0.03247755,
|
||||
"XAU": 0.00041469,
|
||||
"XCD": 2.70255,
|
||||
"XDR": 0.758653,
|
||||
"XOF": 605.324622,
|
||||
"XPD": 0.0010126,
|
||||
"XPF": 110.120697,
|
||||
"XPT": 0.00100911,
|
||||
"YER": 250.375049,
|
||||
"ZAR": 18.109898,
|
||||
"ZMW": 25.343793,
|
||||
"XDR": 0.757288,
|
||||
"XOF": 600.610733,
|
||||
"XPD": 0.00104003,
|
||||
"XPF": 109.263146,
|
||||
"XPT": 0.00099959,
|
||||
"YER": 250.350066,
|
||||
"ZAR": 17.95403,
|
||||
"ZMW": 25.534042,
|
||||
"ZWL": 322
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue