diff --git a/public/admin/config.yml b/public/admin/config.yml index 66a19c6..e80975a 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -40,7 +40,7 @@ collections: - { label: "Image", name: "image", widget: "image", required: false } - { label: "Category", name: "category", widget: "select", options: ["actual","history","other"] } - { label: "Tech Stack", name: "techStack", widget: "list", default: [] } - - { label: "Status", name: "status", widget: "select", options: ["completed","in-progress","planned"] } + - { label: "Status", name: "status", widget: "select", options: ["completed","in-progress","planned","paused"] } - { label: "Live Demo", name: "liveDemo", widget: "string", required: false } - { label: "Source Code", name: "sourceCode", widget: "string", required: false } - { label: "Start Date", name: "startDate", widget: "datetime" } diff --git a/src/components/data/projectCard.astro b/src/components/data/projectCard.astro index 0ac833e..884e8a2 100644 --- a/src/components/data/projectCard.astro +++ b/src/components/data/projectCard.astro @@ -11,7 +11,7 @@ export interface Props { image?: string; category: string; techStack: string[]; - status: "completed" | "in-progress" | "planned"; + status: "completed" | "in-progress" | "planned" | "paused"; demoUrl?: string; sourceUrl?: string; startDate: string; @@ -40,6 +40,8 @@ const getStatusStyle = (status: string) => { return "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"; case "planned": return "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"; + case "paused": + return "bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"; default: return "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"; } @@ -54,6 +56,8 @@ const getStatusText = (status: string) => { return i18n(I18nKey.projectsInProgress); case "planned": return i18n(I18nKey.projectsPlanned); + case "paused": + return i18n(I18nKey.projectsPaused); default: return status; } diff --git a/src/i18n/i18nKey.ts b/src/i18n/i18nKey.ts index 30e4754..b6e1359 100644 --- a/src/i18n/i18nKey.ts +++ b/src/i18n/i18nKey.ts @@ -81,12 +81,14 @@ enum I18nKey { projectStatusCompleted = "projectStatusCompleted", projectStatusInProgress = "projectStatusInProgress", projectStatusPlanned = "projectStatusPlanned", + projectStatusPaused = "projectStatusPaused", projectsTotal = "projectsTotal", projectsCompleted = "projectsCompleted", projectsInProgress = "projectsInProgress", projectsTechStack = "projectsTechStack", projectsFeatured = "projectsFeatured", projectsPlanned = "projectsPlanned", + projectsPaused = "projectsPaused", projectsDemo = "projectsDemo", projectsSource = "projectsSource", diff --git a/src/i18n/languages/en.ts b/src/i18n/languages/en.ts index baeab92..597889d 100644 --- a/src/i18n/languages/en.ts +++ b/src/i18n/languages/en.ts @@ -85,12 +85,14 @@ export const en: Translation = { [Key.projectStatusCompleted]: "Completed", [Key.projectStatusInProgress]: "In Progress", [Key.projectStatusPlanned]: "Planned", + [Key.projectStatusPaused]: "Paused", [Key.projectsTotal]: "Total Projects", [Key.projectsCompleted]: "Completed", [Key.projectsInProgress]: "In Progress", [Key.projectsTechStack]: "Tech Stack Statistics", [Key.projectsFeatured]: "Featured Projects", [Key.projectsPlanned]: "Planned", + [Key.projectsPaused]: "Paused", [Key.projectsDemo]: "Live Demo", [Key.projectsSource]: "Source Code", diff --git a/src/i18n/languages/ja.ts b/src/i18n/languages/ja.ts index 68e320d..01224c4 100644 --- a/src/i18n/languages/ja.ts +++ b/src/i18n/languages/ja.ts @@ -85,12 +85,14 @@ export const ja: Translation = { [Key.projectStatusCompleted]: "完了", [Key.projectStatusInProgress]: "進行中", [Key.projectStatusPlanned]: "予定", + [Key.projectStatusPaused]: "一時停止", [Key.projectsTotal]: "プロジェクト合計", [Key.projectsCompleted]: "完了", [Key.projectsInProgress]: "進行中", [Key.projectsTechStack]: "技術スタック統計", [Key.projectsFeatured]: "注目プロジェクト", [Key.projectsPlanned]: "予定", + [Key.projectsPaused]: "一時停止", [Key.projectsDemo]: "ライブデモ", [Key.projectsSource]: "ソースコード", diff --git a/src/i18n/languages/ru.ts b/src/i18n/languages/ru.ts index 3c04df5..e53f844 100644 --- a/src/i18n/languages/ru.ts +++ b/src/i18n/languages/ru.ts @@ -84,12 +84,14 @@ export const ru: Translation = { [Key.projectStatusCompleted]: "Завершён", [Key.projectStatusInProgress]: "В разработке", [Key.projectStatusPlanned]: "Запланирован", + [Key.projectStatusPaused]: "Приостановлен", [Key.projectsTotal]: "Всего проектов", [Key.projectsCompleted]: "Завершён", [Key.projectsInProgress]: "В разработке", [Key.projectsTechStack]: "Статистика технологий", [Key.projectsFeatured]: "Сейчас я работаю над этим", [Key.projectsPlanned]: "Запланированных", + [Key.projectsPaused]: "Приостановлен", [Key.projectsDemo]: "Демо", [Key.projectsSource]: "Исходный код", diff --git a/src/i18n/languages/zh.ts b/src/i18n/languages/zh.ts index f3c6d4e..04db356 100644 --- a/src/i18n/languages/zh.ts +++ b/src/i18n/languages/zh.ts @@ -85,12 +85,14 @@ export const zh: Translation = { [Key.projectStatusCompleted]: "已完成", [Key.projectStatusInProgress]: "进行中", [Key.projectStatusPlanned]: "计划中", + [Key.projectStatusPaused]: "已暂停", [Key.projectsTotal]: "项目总数", [Key.projectsCompleted]: "已完成", [Key.projectsInProgress]: "进行中", [Key.projectsTechStack]: "技术栈统计", [Key.projectsFeatured]: "精选项目", [Key.projectsPlanned]: "计划中", + [Key.projectsPaused]: "已暂停", [Key.projectsDemo]: "在线演示", [Key.projectsSource]: "源代码", diff --git a/src/utils/projects.ts b/src/utils/projects.ts index fac801f..98f1c65 100644 --- a/src/utils/projects.ts +++ b/src/utils/projects.ts @@ -9,7 +9,7 @@ export interface Project { image: string; category: "actual" | "history" | "other"; techStack: string[]; - status: "completed" | "in-progress" | "planned"; + status: "completed" | "in-progress" | "planned" | "paused"; demoUrl?: string; sourceUrl?: string; startDate: string; @@ -38,12 +38,14 @@ export const getProjectStats = () => { (p) => p.status === "in-progress", ).length; const planned = projectsData.filter((p) => p.status === "planned").length; + const paused = projectsData.filter((p) => p.status === "paused").length; return { total, byStatus: { completed, inProgress, planned, + paused, }, }; }; @@ -71,9 +73,40 @@ export const getFeaturedProjects = () => { // Get all tech stacks export const getAllTechStack = () => { - const techSet = new Set(); + // Создаем Map для хранения информации о каждой технологии + const techMap = new Map(); + + // Подсчитываем упоминания и находим самую свежую дату проекта для каждой технологии projectsData.forEach((project) => { - project.techStack.forEach((tech) => techSet.add(tech)); + const projectDate = new Date(project.startDate).getTime(); + project.techStack.forEach((tech) => { + const existing = techMap.get(tech); + if (existing) { + existing.count++; + // Обновляем дату, если текущий проект свежее + if (projectDate > existing.latestProjectDate) { + existing.latestProjectDate = projectDate; + } + } else { + techMap.set(tech, { count: 1, latestProjectDate: projectDate }); + } + }); }); - return Array.from(techSet).sort(); + + // Преобразуем Map в массив и сортируем + // Сначала по количеству упоминаний (по убыванию), затем по дате самого свежего проекта (по убыванию) + return Array.from(techMap.entries()) + .sort((a, b) => { + const [techA, dataA] = a; + const [techB, dataB] = b; + + // Сначала сортируем по количеству упоминаний (по убыванию) + if (dataB.count !== dataA.count) { + return dataB.count - dataA.count; + } + + // Если количество одинаковое, сортируем по дате самого свежего проекта (по убыванию) + return dataB.latestProjectDate - dataA.latestProjectDate; + }) + .map(([tech]) => tech); // Возвращаем только названия технологий }; \ No newline at end of file