stuff
Some checks are pending
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions

This commit is contained in:
Dmitry 2025-12-17 04:21:12 +03:00
parent c9f557b5b7
commit 8e77f99c02
4 changed files with 13 additions and 26 deletions

View file

@ -1,4 +1,4 @@
import { useState, useEffect, useRef, useMemo } from 'react'
import { useState, useEffect, useRef } from 'react'
import type { InputButtonsQuestion, TestButton } from '@/types/questions'
import { QuestionType } from '@/types/questions'
import { Label } from '@/components/ui/label'
@ -42,9 +42,9 @@ export function InputButtonsQuestionForm({
// Track the initial question to detect when we're editing a different question
const initialQuestionRef = useRef<string | undefined>(question.id)
// Initialize state when question prop changes (e.g., when editing a different question)
// Initialize state when question id changes (e.g., when editing a different question)
useEffect(() => {
// Only sync if the question id changed (different question) or if this is the first render
// Only sync if the question id changed (different question)
if (initialQuestionRef.current !== question.id) {
initialQuestionRef.current = question.id
setWord(question.word || '')

View file

@ -1,4 +1,4 @@
import { useState, useEffect, useRef, useMemo } from 'react'
import { useState, useEffect, useRef } from 'react'
import type { SimpleQuestion, TestButton } from '@/types/questions'
import { QuestionType } from '@/types/questions'
import { Label } from '@/components/ui/label'
@ -41,9 +41,9 @@ export function SimpleQuestionForm({
// Track the initial question to detect when we're editing a different question
const initialQuestionRef = useRef<string | undefined>(question.id)
// Initialize state when question prop changes (e.g., when editing a different question)
// Initialize state when question id changes (e.g., when editing a different question)
useEffect(() => {
// Only sync if the question id changed (different question) or if this is the first render
// Only sync if the question id changed (different question)
if (initialQuestionRef.current !== question.id) {
initialQuestionRef.current = question.id
setWord(question.word || '')

View file

@ -386,8 +386,8 @@ class _CardSide extends StatelessWidget {
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
final cardWidth = math.min(screenSize.width * 0.9, 600.0);
final cardHeight = math.min(screenSize.height * 0.7, 800.0);
final cardWidth = math.min(screenSize.width * 0.9, cardHeight * 0.66);
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
@ -484,10 +484,10 @@ class _CardSide extends StatelessWidget {
child: SingleChildScrollView(
child: MnemoText(
card.mnemo,
textStyle: const TextStyle(
textStyle: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: AppColors.mnemoRed,
color: colorScheme.onSurface,
),
textAlign: TextAlign.center,
maxLines: 4,
@ -558,20 +558,6 @@ class _CardSide extends StatelessWidget {
return Image.network(
imageUrl,
fit: BoxFit.cover,
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) {
return child;
}
return Center(
child: CircularProgressIndicator(
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded /
loadingProgress.expectedTotalBytes!
: null,
color: packColor,
),
);
},
errorBuilder: (context, error, stackTrace) {
return Container(
color: packColor.withOpacity(0.1),
@ -659,11 +645,11 @@ class _CardSide extends StatelessWidget {
)
else
Text(
'Нет текста на обратной стороне',
card.original!,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w400,
color: colorScheme.onSurface.withOpacity(0.38),
color: colorScheme.onSurface,
),
textAlign: TextAlign.center,
),

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../../utils/color_extension.dart';
import '../theme/app_colors.dart';
/// Виджет для отображения текста с форматированием
///
@ -44,7 +45,7 @@ class MnemoText extends StatelessWidget {
final matches = RegExp(r'\{(.*?)\}').allMatches(formattedText);
// Цвет по умолчанию для выделенного текста
Color highlightColor = color ?? Colors.red;
Color highlightColor = color ?? AppColors.mnemoRed;
final List<TextSpan> spans = [];
RegExpMatch? lastMatch;