From 6b7e4fad671d68dd8ae0fd4058c9d0643cfc3930 Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Wed, 4 Oct 2023 16:50:07 +0200 Subject: [PATCH] Configurable market tags --- .env.example | 3 +++ lib/constants/markets.ts | 10 ++++------ lib/types/market-filter.ts | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 63162a08c..9ee9129cf 100644 --- a/.env.example +++ b/.env.example @@ -40,3 +40,6 @@ NEXT_PUBLIC_SITE_URL=http://localhost:3000 # disable grillchat NEXT_PUBLIC_GRILLCHAT_DISABLE=true + +NEXT_PUBLIC_OTHER_TAGS=["Coindesk"] + diff --git a/lib/constants/markets.ts b/lib/constants/markets.ts index 51abfd1fb..1fd75484e 100644 --- a/lib/constants/markets.ts +++ b/lib/constants/markets.ts @@ -1,5 +1,4 @@ import { EMarketStatus, MarketStatus } from "lib/types/markets"; -import { environment } from "."; const prodTags = [ "Politics", @@ -13,12 +12,11 @@ const prodTags = [ "E-Sports", ] as const; -const otherTags = ["Coindesk"] as const; +const otherTags = process.env.NEXT_PUBLIC_OTHER_TAGS + ? JSON.parse(process.env.NEXT_PUBLIC_OTHER_TAGS) + : []; -export const defaultTags = [ - ...prodTags, - ...(environment !== "production" ? otherTags : []), -] as const; +export const defaultTags = [...prodTags, ...otherTags] as const; export type SupportedTag = typeof defaultTags[number]; diff --git a/lib/types/market-filter.ts b/lib/types/market-filter.ts index 2ddbd11da..36ec67bda 100644 --- a/lib/types/market-filter.ts +++ b/lib/types/market-filter.ts @@ -14,7 +14,7 @@ export type MarketOrderByOption = { value: MarketsOrderBy; }; -export type MarketFilterTagLabel = typeof CATEGORIES[number]["name"]; +export type MarketFilterTagLabel = typeof CATEGORIES[number]["name"] | string; export type MarketFilterStatusLabel = MarketStatus;