From defe5f64c773ed93f348fc6cb7c332fd00998913 Mon Sep 17 00:00:00 2001 From: John Doe Date: Sun, 10 Sep 2023 17:07:00 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Refactor=20taxonomies=20initiali?= =?UTF-8?q?zation=20=F0=9F=93=A6=20Organize=20taxonomy=20data=20for=20cate?= =?UTF-8?q?gories=20and=20tags=20=F0=9F=8F=A1=20Include=20stay=20categorie?= =?UTF-8?q?s=20with=20listing=20type=20=F0=9F=8C=9F=20Add=20experiences=20?= =?UTF-8?q?categories=20with=20listing=20type=20=F0=9F=9A=80=20Ready=20for?= =?UTF-8?q?=20taxonomies=20integration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/data/taxonomies.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/data/taxonomies.ts diff --git a/src/data/taxonomies.ts b/src/data/taxonomies.ts new file mode 100644 index 0000000..d6f5800 --- /dev/null +++ b/src/data/taxonomies.ts @@ -0,0 +1,42 @@ +import __taxonomies from "./jsons/__taxonomies.json"; +import __stayTaxonomies from "./jsons/__stayTaxonomies.json"; +import __experiencesTaxonomies from "./jsons/__experiencesTaxonomies.json"; +import { TaxonomyType } from "./types"; +import { Route } from "@/routers/types"; + +const DEMO_CATEGORIES: TaxonomyType[] = __taxonomies.map((item) => ({ + ...item, + taxonomy: "category", + href: item.href as Route, +})); + +const DEMO_TAGS: TaxonomyType[] = __taxonomies.map((item) => ({ + ...item, + taxonomy: "tag", + href: item.href as Route, +})); + +// + +const DEMO_STAY_CATEGORIES: TaxonomyType[] = __stayTaxonomies.map((item) => ({ + ...item, + taxonomy: "category", + listingType: "stay", + href: item.href as Route, +})); +// +const DEMO_EXPERIENCES_CATEGORIES: TaxonomyType[] = __experiencesTaxonomies.map( + (item) => ({ + ...item, + taxonomy: "category", + listingType: "experiences", + href: item.href as Route, + }) +); + +export { + DEMO_CATEGORIES, + DEMO_TAGS, + DEMO_STAY_CATEGORIES, + DEMO_EXPERIENCES_CATEGORIES, +};