-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Перевод UI на Material Design 3 #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/xierongchuan/TaskMateTelegramBot/issues/31
Внедрение принципов Material Design 3 в Telegram бот интерфейс: ## Новый дизайн-система MaterialDesign3Trait - Централизованная система иконок с семантическими emoji - Типографика с вспомогательными методами (md3Headline, md3Card) - Персонализированные приветствия по времени суток - Плюрализация для русского языка ## Обновленные компоненты - KeyboardTrait: MD3 паттерны кнопок, новые методы клавиатур - TaskNotificationService: чистое MD3 форматирование сообщений - StartConversation: приветствия с контекстом времени - OpenShiftConversation: улучшенный UX для фото и выбора - CloseShiftConversation: чистый формат уведомлений - ViewTasksCommand/ViewShiftsCommand/ViewDealershipsCommand: MD3 списки - TaskResponseHandler: лаконичная обратная связь ## Принципы MD3 - Визуальная иерархия через типографику - Семантическая иконография - Немедленная обратная связь через toast - Консистентные паттерны форматирования 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 026def3.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 issues found across 11 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="app/Traits/MaterialDesign3Trait.php">
<violation number="1" location="app/Traits/MaterialDesign3Trait.php:432">
P2: `strtotime()` can return `false` on invalid input, which will cause a `TypeError` in PHP 8+ when passed to `date()`. Consider adding validation or using a try-catch with `DateTimeImmutable`.</violation>
<violation number="2" location="app/Traits/MaterialDesign3Trait.php:608">
P2: Unused variable `$icon` - the computed icon based on `$action` is never used. The code always shows `$iconSuccess` instead of the action-specific icon (`$iconOpen` or `$iconClose`). Consider using `$icon` in the output or removing the unused variable.</violation>
</file>
<file name="app/Services/TaskNotificationService.php">
<violation number="1" location="app/Services/TaskNotificationService.php:661">
P2: Pluralization mismatch: the displayed value (`round($offset / 60, 1)`) can differ from the value used for pluralization (`(int) round($offset / 60)`), causing grammatically incorrect Russian output (e.g., '1.3 час' instead of '1.3 часа'). Consider using `(int) round($offset / 60)` for both display and pluralization, or handle fractional hours differently.</violation>
</file>
<file name="app/Bot/Conversations/Guest/StartConversation.php">
<violation number="1" location="app/Bot/Conversations/Guest/StartConversation.php:239">
P2: Code duplication: The greeting logic duplicates `md3Greeting()` from the trait. Consider using the trait method instead to maintain consistency and reduce duplication.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| */ | ||
| protected static function md3FormatDate(string $date, string $format = 'd.m.Y'): string | ||
| { | ||
| return date($format, strtotime($date)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: strtotime() can return false on invalid input, which will cause a TypeError in PHP 8+ when passed to date(). Consider adding validation or using a try-catch with DateTimeImmutable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/Traits/MaterialDesign3Trait.php, line 432:
<comment>`strtotime()` can return `false` on invalid input, which will cause a `TypeError` in PHP 8+ when passed to `date()`. Consider adding validation or using a try-catch with `DateTimeImmutable`.</comment>
<file context>
@@ -0,0 +1,693 @@
+ */
+ protected static function md3FormatDate(string $date, string $format = 'd.m.Y'): string
+ {
+ return date($format, strtotime($date));
+ }
+
</file context>
| return date($format, strtotime($date)); | |
| $timestamp = strtotime($date); | |
| return $timestamp !== false ? date($format, $timestamp) : $date; |
| $icon = $action === 'open' ? static::$iconOpen : static::$iconClose; | ||
| $actionText = $action === 'open' ? 'Смена открыта' : 'Смена закрыта'; | ||
| $lines[] = static::$iconSuccess . ' *' . $actionText . '*'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Unused variable $icon - the computed icon based on $action is never used. The code always shows $iconSuccess instead of the action-specific icon ($iconOpen or $iconClose). Consider using $icon in the output or removing the unused variable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/Traits/MaterialDesign3Trait.php, line 608:
<comment>Unused variable `$icon` - the computed icon based on `$action` is never used. The code always shows `$iconSuccess` instead of the action-specific icon (`$iconOpen` or `$iconClose`). Consider using `$icon` in the output or removing the unused variable.</comment>
<file context>
@@ -0,0 +1,693 @@
+ $lines = [];
+
+ // Main action result
+ $icon = $action === 'open' ? static::$iconOpen : static::$iconClose;
+ $actionText = $action === 'open' ? 'Смена открыта' : 'Смена закрыта';
+ $lines[] = static::$iconSuccess . ' *' . $actionText . '*';
</file context>
| $icon = $action === 'open' ? static::$iconOpen : static::$iconClose; | |
| $actionText = $action === 'open' ? 'Смена открыта' : 'Смена закрыта'; | |
| $lines[] = static::$iconSuccess . ' *' . $actionText . '*'; | |
| $icon = $action === 'open' ? static::$iconOpen : static::$iconClose; | |
| $actionText = $action === 'open' ? 'Смена открыта' : 'Смена закрыта'; | |
| $lines[] = $icon . ' *' . $actionText . '*'; |
|
|
||
| // Critical header with time indicator | ||
| $overdueText = $offset >= 60 | ||
| ? round($offset / 60, 1) . ' ' . $this->pluralize((int) round($offset / 60), 'час', 'часа', 'часов') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Pluralization mismatch: the displayed value (round($offset / 60, 1)) can differ from the value used for pluralization ((int) round($offset / 60)), causing grammatically incorrect Russian output (e.g., '1.3 час' instead of '1.3 часа'). Consider using (int) round($offset / 60) for both display and pluralization, or handle fractional hours differently.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/Services/TaskNotificationService.php, line 661:
<comment>Pluralization mismatch: the displayed value (`round($offset / 60, 1)`) can differ from the value used for pluralization (`(int) round($offset / 60)`), causing grammatically incorrect Russian output (e.g., '1.3 час' instead of '1.3 часа'). Consider using `(int) round($offset / 60)` for both display and pluralization, or handle fractional hours differently.</comment>
<file context>
@@ -506,113 +519,209 @@ private function getNotificationOffset(Task $task, string $channelType): ?int
+
+ // Critical header with time indicator
+ $overdueText = $offset >= 60
+ ? round($offset / 60, 1) . ' ' . $this->pluralize((int) round($offset / 60), 'час', 'часа', 'часов')
+ : $offset . ' ' . $this->pluralize($offset, 'минута', 'минуты', 'минут');
+
</file context>
| $greeting = match (true) { | ||
| $hour >= 5 && $hour < 12 => ['🌅', 'Доброе утро'], | ||
| $hour >= 12 && $hour < 17 => ['☀️', 'Добрый день'], | ||
| $hour >= 17 && $hour < 22 => ['🌆', 'Добрый вечер'], | ||
| default => ['🌙', 'Доброй ночи'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Code duplication: The greeting logic duplicates md3Greeting() from the trait. Consider using the trait method instead to maintain consistency and reduce duplication.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/Bot/Conversations/Guest/StartConversation.php, line 239:
<comment>Code duplication: The greeting logic duplicates `md3Greeting()` from the trait. Consider using the trait method instead to maintain consistency and reduce duplication.</comment>
<file context>
@@ -184,18 +229,27 @@ private function handleSuccessfulLogin(Nutgram $bot, User $user): void
+ $hour = (int) date('H');
+
+ // MD3 time-based greeting with expressive icons
+ $greeting = match (true) {
+ $hour >= 5 && $hour < 12 => ['🌅', 'Доброе утро'],
+ $hour >= 12 && $hour < 17 => ['☀️', 'Добрый день'],
</file context>
| $greeting = match (true) { | |
| $hour >= 5 && $hour < 12 => ['🌅', 'Доброе утро'], | |
| $hour >= 12 && $hour < 17 => ['☀️', 'Добрый день'], | |
| $hour >= 17 && $hour < 22 => ['🌆', 'Добрый вечер'], | |
| default => ['🌙', 'Доброй ночи'], | |
| $greeting = static::md3Greeting(); |
Summary
Внедрение принципов Material Design 3 в Telegram бот интерфейс.
Fixes #31
Изменения
MaterialDesign3Trait.php (новый): Централизованная MD3 дизайн-система
KeyboardTrait.php: MD3 паттерны кнопок
TaskNotificationService.php: MD3 форматирование сообщений
StartConversation.php: Улучшенный UX входа
OpenShiftConversation.php / CloseShiftConversation.php: MD3 диалоги смен
ViewTasksCommand.php / ViewShiftsCommand.php / ViewDealershipsCommand.php: MD3 списки
TaskResponseHandler.php: Лаконичная обратная связь
Принципы MD3
Test plan
🤖 Generated with Claude Code
Summary by cubic
Перевели интерфейс Telegram-бота на Material Design 3: единая дизайн‑система, понятные списки и мгновенная обратная связь. Закрывает #31.
New Features
Refactors
Written for commit 997d7b0. Summary will update on new commits.