Skip to content

Commit

Permalink
Merge pull request #10 from MarkMelior/feature/VEES-18-reused-info-block
Browse files Browse the repository at this point in the history
VEES-18 | Переиспользуемый компонент InfoBlock
  • Loading branch information
MarkMelior authored Jan 8, 2025
2 parents 8073940 + 842266a commit 118f9b8
Show file tree
Hide file tree
Showing 80 changed files with 945 additions and 505 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

### 🫡 Общие правила проекта
### 📋✏️ Общие правила проекта

#### Архитектура

Expand Down Expand Up @@ -62,7 +62,9 @@

---

### 👾 Скрипты

### 🎬📃 Скрипты

- `yarn dev` - Запуск в Development режиме;
- `yarn build` - Production сборка;
Expand All @@ -71,7 +73,9 @@

---

### ⚡️ Архитектура проекта

### 📂⚡️ Архитектура проекта

Проект написан в соответствии с архитектурной методологией [Feature-Sliced Design](https://feature-sliced.design/docs/get-started/tutorial) и [AppRouter](https://nextjs.org/docs/app) Next.js 15.

Expand Down
6 changes: 6 additions & 0 deletions docs/naming-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Vees — Тренировка
- All Vees — Все тренировки
- Exercise — Упражнение
- Muscle — Группа мышц
- Vees Template - Шаблон тренировки
- Approach - Подход
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ const eslintCommonRules = {
},
{ blankLine: 'always', next: 'return', prev: '*' },
],
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
};

const eslintReactRules = {
Expand All @@ -63,6 +71,13 @@ const eslintReactRules = {
};

const eslintTypescriptRules = {
'@typescript-eslint/consistent-type-imports': [
'error',
{
disallowTypeAnnotations: false, // Позволяет аннотации через `import type`
prefer: 'type-imports', // Всегда использовать "import type" для типов
},
],
'@typescript-eslint/no-unused-vars': 'error',
};

Expand Down
48 changes: 39 additions & 9 deletions src/app/(with-navbar)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Card } from '@/widgets/Card';
import { mockExerciseListItems } from '@/widgets/Card/model/mock';
import { Headers } from '@/widgets/Headers';
import { InfoBlock } from '@/widgets/InfoBlock/client';
import { mockInfoBlockExercisesItems } from '@/widgets/InfoBlock/model/mock-exercises';

import { ArrowLeftIcon, FilterOutlineIcon } from '@/shared/icons';
import { Badge, Button, Flex, Layout, Separator } from '@/shared/ui';
import { ArrowLeftIcon, FilterOutlineIcon, StopwatchOutlineIcon } from '@/shared/icons';
import { Badge, Button, Flex, Layout, List, Separator } from '@/shared/ui';
import { InfoBlock } from '@/shared/ui/client';

import { FiltersModal } from '@/features/FiltersModal';
import { SortModal } from '@/features/SortModal';
Expand All @@ -15,11 +16,36 @@ const Home = () => (
<Headers.Main />
<main>
<Layout>
<InfoBlock
items={mockInfoBlockExercisesItems}
showAllCountItems={2}
showAllText="Показать всю статистику"
/>
<InfoBlock maxHeight={126} textButton="Показать всю статистику">
<List.Item
description="~ конец в 18:36"
icon={<StopwatchOutlineIcon />}
title="Расчётное время"
value="~ 1 час 30 минут"
/>
<List.Horizontal
items={[
{
title: 'Тренировка №',
value: '98',
},
{
title: 'Начало',
value: '17:06',
},
{
title: 'Упражнений',
value: '7',
},
]}
/>
<List.Item
icon={<StopwatchOutlineIcon />}
showDivider={false}
title="Пусто"
value="Пусто"
/>
</InfoBlock>
<Separator size={18} />
<Flex gap={10} id="home-filters-buttons">
<FiltersModal>
Expand Down Expand Up @@ -52,6 +78,10 @@ const Home = () => (
</SortModal>
</Flex>
</Layout>
<Separator size={32} />
<Layout padding={false}>
<Card.ExercisesList items={mockExerciseListItems} />
</Layout>
</main>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions src/app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ body {

:disabled {
cursor: not-allowed;
}

main > *:last-child {
padding-bottom: 180px;
}
52 changes: 45 additions & 7 deletions src/app/vees/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Card } from '@/widgets/Card';
import { mockVeesListItems } from '@/widgets/Card/model/mock';
import { Headers } from '@/widgets/Headers';
import { InfoBlock } from '@/widgets/InfoBlock/client';
import { mockInfoBlockVeesItems } from '@/widgets/InfoBlock/model/mock-vees';
import { VeesList } from '@/widgets/VeesList/client';
import { mockVeesListItems } from '@/widgets/VeesList/model/mock';

import { Layout, Separator } from '@/shared/ui';
import { PaperOutlineIcon, StopwatchOutlineIcon } from '@/shared/icons';
import { Chip, Layout, List, Separator } from '@/shared/ui';
import { InfoBlock } from '@/shared/ui/client';

import { Timer } from '@/features/Timer/client';

Expand All @@ -13,11 +13,49 @@ const Vees = () => (
<Headers.ExercisesList />
<main>
<Layout>
<InfoBlock items={mockInfoBlockVeesItems} />
<InfoBlock>
<List.Item
description="~ конец в 18:36"
icon={<StopwatchOutlineIcon />}
title="Расчётное время"
value="~ 1 час 30 минут"
/>
<List.Item
icon={<PaperOutlineIcon />}
title="Тренировка"
value={(
<Chip.Category
className="mt-1"
color="text-red-500"
isEdited={true}
name="Вторник"
number={9}
size="medium"
/>
)}
/>
<List.Horizontal
items={[
{
title: 'Тренировка №',
value: '98',
},
{
title: 'Начало',
value: '17:06',
},
{
title: 'Упражнений',
value: '7',
},
]}
showDivider={false}
/>
</InfoBlock>
</Layout>
<Separator size={32} />
<Layout padding={false}>
<VeesList items={mockVeesListItems} />
<Card.VeesList items={mockVeesListItems} />
</Layout>
</main>
<Timer />
Expand Down
2 changes: 1 addition & 1 deletion src/features/Timer/ui/Timer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { clsx } from 'clsx';
import { useState, useEffect, useCallback, useMemo } from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';

import { PauseIcon, PlayIcon, StopwatchOutlineIcon } from '@/shared/icons';
import { Background, Button, Flex, Layout, Text } from '@/shared/ui';
Expand Down
4 changes: 4 additions & 0 deletions src/shared/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export * from './routes';

export const getErrorGroupDirectly = (text: string) => {
throw new Error(`The \'${text}\' component is a group and cannot be used directly.`);
};
3 changes: 2 additions & 1 deletion src/shared/icons/add-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const AddOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/arrow-dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const ArrowDropdownIcon = ({
className,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/arrow-left.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const ArrowLeftIcon = ({
className,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/cross.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const CrossIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/drag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const DragIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/export-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const ExportOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/filter-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const FilterOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/finish-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const FinishOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/flash-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const FlashOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/folder-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const FolderOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/import-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const ImportOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/lang.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const LangIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const LogoIcon = ({
className,
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/message.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const MessageIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/paper-outline.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const PaperOutlineIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/pause.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const PauseIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/play.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const PlayIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/plus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const PlusIcon = ({
fill = 'currentColor',
Expand Down
3 changes: 2 additions & 1 deletion src/shared/icons/reset.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';

import { Icon, IIcon } from '@/shared/ui';
import { Icon } from '@/shared/ui';
import type { IIcon } from '@/shared/ui';

export const ResetIcon = ({
fill = 'currentColor',
Expand Down
Loading

0 comments on commit 118f9b8

Please sign in to comment.