diff --git a/public/img/projects/liferes.jpg b/public/img/projects/liferes.jpg new file mode 100644 index 0000000..4b9db2b Binary files /dev/null and b/public/img/projects/liferes.jpg differ diff --git a/public/img/projects/nks.jpg b/public/img/projects/nks.jpg new file mode 100644 index 0000000..5da79d1 Binary files /dev/null and b/public/img/projects/nks.jpg differ diff --git a/public/img/projects/upside.jpg b/public/img/projects/upside.jpg new file mode 100644 index 0000000..656d0ae Binary files /dev/null and b/public/img/projects/upside.jpg differ diff --git a/src/data/streamingProjects.ts b/src/data/streamingProjects.ts new file mode 100644 index 0000000..9b36db8 --- /dev/null +++ b/src/data/streamingProjects.ts @@ -0,0 +1,58 @@ +import type { IProject } from "@/types"; + +const BASE: Omit< + IProject, + | "id" + | "title" + | "englishTitle" + | "city" + | "englishCity" + | "buildFilename" + | "image" +> = { + description: "", + stage: 0, + releaseDate: "2026-01-01T00:00:00.000Z", + tags: [], +}; + +const RU_PROJECTS: IProject[] = [ + { + ...BASE, + id: "revolution-towers", + title: "МФК «Revolution towers»", + englishTitle: "Revolution Towers", + city: "Россия, Екатеринбург", + englishCity: "Russia, Yekaterinburg", + buildFilename: "nksJukovaDev", + image: "/img/projects/nks.jpg", + }, + { + ...BASE, + id: "life-residence", + title: "ЖК «Life Резиденция»", + englishTitle: "Life Residence", + city: "Россия, Тюмень", + englishCity: "Russia, Tyumen", + buildFilename: "lifeResidence", + image: "/img/projects/liferes.jpg", + }, +]; + +const EN_PROJECTS: IProject[] = [ + { + ...BASE, + id: "upside-towers", + title: "Upside Towers", + englishTitle: "Upside Towers", + city: "Russia, Moscow", + englishCity: "Russia, Moscow", + buildFilename: "upsideTowersDevEn", + image: "/img/projects/upside.jpg", + }, +]; + +/** Demo projects for the streaming section, selected by UI language. */ +export function getStreamingProjects(i18nLanguage: string): IProject[] { + return i18nLanguage.startsWith("ru") ? RU_PROJECTS : EN_PROJECTS; +} diff --git a/src/features/stream-demo/AvailableDemos.tsx b/src/features/stream-demo/AvailableDemos.tsx index 2ee8bfa..158f6e9 100644 --- a/src/features/stream-demo/AvailableDemos.tsx +++ b/src/features/stream-demo/AvailableDemos.tsx @@ -1,30 +1,26 @@ -import { useRef, useState, type MouseEvent as ReactMouseEvent } from "react"; +import { useMemo, useRef, useState, type MouseEvent as ReactMouseEvent } from "react"; import { useTranslation } from "react-i18next"; import BR from "@/components/Layout/LineBreak"; -import { - REMOTE_DEMO_TAG, - useGetProjectsQuery, -} from "@/queries/getProjects"; +import { getStreamingProjects } from "@/data/streamingProjects"; import { StreamingProject } from "./StreamingProject"; import { useSwipeable } from "react-swipeable"; import { useMediaQueries } from "@/hooks/useMediaQueries"; export default function AvailableDemos() { - const { t } = useTranslation(); + const { t, i18n } = useTranslation(); const { isMd } = useMediaQueries(); - const { data: streamingProjects } = useGetProjectsQuery(REMOTE_DEMO_TAG); + const projects = useMemo( + () => getStreamingProjects(i18n.language), + [i18n.language] + ); const [current, setCurrent] = useState(0); - const projects = streamingProjects ?? []; - const slideCount = Math.min(projects.length + 1, 4); + const slideCount = projects.length + 1; const handlers = useSwipeable({ onSwipedLeft: () => setCurrent((prev) => (prev + 1) % Math.max(slideCount, 1)), onSwipedRight: () => - setCurrent( - (prev) => - (prev + Math.min(projects.length, 4)) % Math.max(slideCount, 1) - ), + setCurrent((prev) => (prev + projects.length) % Math.max(slideCount, 1)), trackMouse: true, preventScrollOnSwipe: true, touchEventOptions: { passive: false }, @@ -65,7 +61,7 @@ export default function AvailableDemos() { className="grid lg:hidden md:hidden grid-cols-4 gap-3 px-5 [scrollbar-width:none] relative max-md:aspect-[340/344] [transform-style:preserve-3d] items-stretch mb-[5.556vw]" {...handlers} > - {projects.slice(0, 3).map((project, index, { length }) => ( + {projects.map((project, index, { length }) => ( - {projects.slice(0, 3).map((project, index, { length }) => ( + {projects.map((project, index, { length }) => (
0 - ? Array.isArray(tags) - ? tags - : [tags] - : []; - - return useQuery( - queryOptions({ - queryKey: queryKeys.projectsWithTags(tagList), - queryFn: () => { - if (tagList.length === 0) { - return api.get("projects").json(); - } - const qs = tagList - .map((tag) => `tags=${encodeURIComponent(tag)}`) - .join("&"); - return api.get(`projects?${qs}`).json(); - }, - enabled: hasApiConfigured, - select: - tags === REMOTE_DEMO_TAG || - (Array.isArray(tags) && - tags.length === 1 && - tags[0] === REMOTE_DEMO_TAG) - ? (data) => - [...data] - .sort((a, b) => releaseTimestamp(b) - releaseTimestamp(a)) - .slice(0, 3) - : undefined, - }) - ); -} diff --git a/src/queries/keys.ts b/src/queries/keys.ts index 78f2344..dcfe023 100644 --- a/src/queries/keys.ts +++ b/src/queries/keys.ts @@ -1,5 +1,3 @@ export const queryKeys = { - projects: ["projects"] as const, - projectsWithTags: (tags: string[]) => ["projects", ...tags] as const, countryCode: ["countryCode"] as const, };