From 81151ec4a61b4314892776132f26cd7a2b76018d Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Tue, 31 Mar 2026 14:55:32 +0700 Subject: [PATCH] update design --- src/assets/base.css | 2 +- src/components/SchedulePage.vue | 19 +++++++++++++++---- src/components/date.ts | 30 ++++++++++++++++++------------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/assets/base.css b/src/assets/base.css index 9b09752..80077ae 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -61,7 +61,7 @@ body { min-height: 100vh; color: var(--color-text); - background: #eee; + background: #ccc; transition: color 0.5s, background-color 0.5s; diff --git a/src/components/SchedulePage.vue b/src/components/SchedulePage.vue index a621d21..a77caa0 100644 --- a/src/components/SchedulePage.vue +++ b/src/components/SchedulePage.vue @@ -2,7 +2,7 @@ import { onMounted, ref } from 'vue'; import { apiGetDays } from './client'; import type { Schedule } from './models'; -import { formatRussianDate, formatTime, getRelativeDayName, timeAgo, formatTimeRange } from './date'; +import { formatRussianDate, cleanTime, getRelativeDayName, timeAgo, formatTimeRange } from './date'; import { capitalizeFirstLetter } from './text'; const schedule = ref({ updateTime: "", days: [] }) @@ -17,12 +17,13 @@ onMounted(async () => {
{{ capitalizeFirstLetter(formatRussianDate(day.date)) }} - ({{ getRelativeDayName(day.date) }}) + {{ getRelativeDayName(day.date) + }}

- Сбор: {{ formatTime(performance.timeCollection) }} + Сбор: {{ cleanTime(performance.timeCollection) }}
Время: @@ -55,16 +56,18 @@ onMounted(async () => { diff --git a/src/components/date.ts b/src/components/date.ts index 67246e5..82531d5 100644 --- a/src/components/date.ts +++ b/src/components/date.ts @@ -149,18 +149,6 @@ export function timeAgo(goDateStr: string): string { }); } -export function formatTime(timeStr: string): string { - if (!timeStr) { - return ""; - } - - return timeStr - // 1. Убираем абсолютно все пробелы (включая табы и неразрывные пробелы) - .replace(/\s+/g, "") - // 2. Заменяем все точки на двоеточия - .replace(/\./g, ":"); -} - export function formatTimeRange(text: string): string { if (!text) { return ""; @@ -185,3 +173,21 @@ export function formatTimeRange(text: string): string { .trim(); } + +export function cleanTime(text: string): string { + if (!text) return text; + + // Ищем шаблон: 1-2 цифры, затем [двоеточие или точка] с возможными пробелами, затем 2 цифры + const match = text.match(/\d{1,2}\s*[:.]\s*\d{2}/); + + if (match) { + // Берем найденный кусок (например, "8. 00") + const extractedTime = match[0]; + + // Удаляем все пробелы и заменяем точку на двоеточие + return extractedTime.replace(/\s+/g, '').replace('.', ':'); + } + + // Если время не найдено, возвращаем исходный текст + return text; +}