Skip to content

Commit 9f3049f

Browse files
authored
feat: new shared & update deps (#92)
1 parent eacf110 commit 9f3049f

38 files changed

+583
-510
lines changed

__tests__/base/mocs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Lesson } from 'diary-shared'
1+
import { Lesson } from '@diary-spo/shared'
22
import { IMarksByDay } from '../../src/components'
33

44
/** Переданные данные **/

__tests__/formatted/f.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
formatLessonName,
88
formatStatisticsData,
99
} from '@utils'
10-
import { PerformanceCurrent } from 'diary-shared'
10+
import { PerformanceCurrent } from '@diary-spo/shared'
1111

1212
describe('Тесты утилит для форматирования', () => {
1313
/** convertStringToTime **/

__tests__/marks/m.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
getSize,
88
setDefaultMark,
99
} from '@utils'
10-
import { Task } from 'diary-shared'
10+
import { Task } from '@diary-spo/shared'
11+
1112
import {
1213
expectedExtractByDayData,
1314
expectedInvalidExtractByDayData,

__tests__/marks/mocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PerformanceCurrent } from 'diary-shared'
1+
import { PerformanceCurrent } from '@diary-spo/shared'
22
import { SubjectMarksMap } from '@utils'
33

44
/** createSubjectMarksMap */

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,47 @@
1515
"coverage": "vitest run --coverage"
1616
},
1717
"dependencies": {
18-
"@vkontakte/icons": "^2.72.0",
19-
"@vkontakte/vk-bridge": "^2.11.2",
18+
"@vkontakte/icons": "^2.79.0",
19+
"@vkontakte/vk-bridge": "^2.12.1",
2020
"@vkontakte/vk-bridge-react": "^1.0.0",
21-
"@vkontakte/vk-mini-apps-router": "^1.1.1",
22-
"@vkontakte/vkui": "^5.9.4",
21+
"@vkontakte/vk-mini-apps-router": "^1.2.0",
22+
"@vkontakte/vkui": "^5.9.6",
2323
"jshashes": "^1.0.8",
24-
"preact": "^10.16.0",
24+
"preact": "^10.19.2",
2525
"react": "npm:@preact/compat",
2626
"react-dom": "npm:@preact/compat"
2727
},
2828
"devDependencies": {
29-
"@babel/eslint-parser": "^7.22.15",
30-
"@preact/preset-vite": "^2.5.0",
29+
"@babel/eslint-parser": "^7.23.3",
30+
"@diary-spo/shared": "^1.8.5",
31+
"@preact/preset-vite": "^2.7.0",
3132
"@rollup/plugin-terser": "^0.4.4",
32-
"@types/node": "^20.8.7",
33-
"@typescript-eslint/eslint-plugin": "^6.0.0",
34-
"@typescript-eslint/parser": "^6.8.0",
33+
"@types/node": "^20.9.1",
34+
"@typescript-eslint/eslint-plugin": "^6.11.0",
35+
"@typescript-eslint/parser": "^6.11.0",
3536
"@vitest/coverage-v8": "^0.34.6",
3637
"@vkontakte/vk-miniapps-deploy": "^0.1.6",
37-
"diary-shared": "^1.8.1",
38-
"eslint": "^8.52.0",
38+
"eslint": "^8.53.0",
3939
"eslint-config-airbnb": "^19.0.4",
4040
"eslint-config-airbnb-typescript": "^17.1.0",
4141
"eslint-config-preact": "^1.3.0",
4242
"eslint-config-prettier": "^9.0.0",
43-
"eslint-config-standard-with-typescript": "^38.0.0",
43+
"eslint-config-standard-with-typescript": "^39.1.1",
4444
"eslint-plugin-import": "^2.25.2",
4545
"eslint-plugin-jest": "^27.4.3",
46-
"eslint-plugin-jsx-a11y": "^6.5.1",
47-
"eslint-plugin-n": "^16.0.2",
46+
"eslint-plugin-jsx-a11y": "^6.8.0",
47+
"eslint-plugin-n": "^16.3.1",
4848
"eslint-plugin-preact": "^0.1.0",
4949
"eslint-plugin-prettier": "^5.0.1",
5050
"eslint-plugin-promise": "^6.0.0",
5151
"eslint-plugin-react": "^7.32.2",
5252
"eslint-plugin-react-hooks": "^4.6.0",
53-
"eslint-plugin-react-refresh": "^0.4.3",
53+
"eslint-plugin-react-refresh": "^0.4.4",
5454
"gh-pages": "^6.0.0",
5555
"jsdom": "^22.1.0",
56-
"prettier": "^3.0.3",
56+
"prettier": "^3.1.0",
5757
"typescript": "^5.2.2",
58-
"vite": "^4.4.5",
58+
"vite": "^5.0.0",
5959
"vitest": "^0.34.6",
6060
"vitest-localstorage-mock": "^0.0.1"
6161
}

src/components/ScheduleGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CardGrid } from '@vkontakte/vkui'
2-
import { Day } from 'diary-shared'
2+
import { Day } from '@diary-spo/shared'
33
import { FunctionComponent } from 'preact'
44
import { memo } from 'preact/compat'
55
import LessonCard from './UI/Lesson/LessonCard'

src/components/UI/AttestationSubjects/SubjectCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Card, CardGrid, Div, InfoRow, Subhead, Title } from '@vkontakte/vkui'
22
import { FunctionalComponent } from 'preact'
3-
import { Examinations } from 'diary-shared'
3+
import { Examinations } from '@diary-spo/shared'
44
import Subject from './types'
55

66
interface ISubjectCard {

src/components/UI/AttestationSubjects/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ExaminationType } from 'diary-shared'
1+
import { ExaminationType } from '@diary-spo/shared'
22

33
export default interface Subject {
44
id: string

src/components/UI/Lesson/LessonCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FC, memo } from 'react'
22
import { Card, Group, Placeholder } from '@vkontakte/vkui'
33
import { useRouteNavigator } from '@vkontakte/vk-mini-apps-router'
44
import { useCallback } from 'preact/hooks'
5-
import { Day, Gradebook, Timetable } from 'diary-shared'
5+
import { Day, Gradebook, Timetable } from '@diary-spo/shared'
66
import useModal from '../../../store/useModal'
77
import { MODAL_PAGE_LESSON } from '../../../modals/ModalRoot'
88
import { formatLessonDate, isToday } from '@utils'
@@ -67,8 +67,8 @@ const LessonCard: FC<ILessonCard> = ({ lesson }) => {
6767
const displayDay = isLessonToday
6868
? 'Сегодня'
6969
: dayEnded
70-
? ' День завершён'
71-
: undefined
70+
? ' День завершён'
71+
: undefined
7272

7373
const lessonComponents = useMemo(() => {
7474
if (lesson.lessons && lesson.lessons.length > 0) {

src/components/UI/Lesson/LessonCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC } from 'react'
22
import { SimpleCell } from '@vkontakte/vkui'
3-
import { Gradebook, Lesson, Timetable } from 'diary-shared'
3+
import { Gradebook, Lesson, Timetable } from '@diary-spo/shared'
44
import LessonSubtitle from './LessonSubtitle'
55
import { setDefaultMark } from '@utils'
66
import Mark from '../Mark'

src/components/UI/Lesson/LessonSubtitle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AbsenceTypes, Gradebook, LessonWorkType } from 'diary-shared'
1+
import { AbsenceTypes, Gradebook, LessonWorkType } from '@diary-spo/shared'
22
import { FC } from 'react'
33
import TimeRemaining from '../TimeRemaining'
44
import SubtitleWithBorder from '../SubtitleWithBorder'

src/components/UI/Marks/MarksByGroup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC } from 'react'
1+
import { FC } from 'preact/compat'
22
import {
33
Card,
44
CardGrid,
@@ -8,7 +8,7 @@ import {
88
HorizontalScroll,
99
Title,
1010
} from '@vkontakte/vkui'
11-
import { PerformanceCurrent } from 'diary-shared'
11+
import { PerformanceCurrent } from '@diary-spo/shared'
1212
import { createSubjectMarksMap } from '@utils'
1313
import MarksList from './MarksList'
1414
import AverageMarkCell from './AverageMarkCell'
@@ -20,7 +20,7 @@ interface IMarksByGroup {
2020

2121
const MarksByGroup: FC<IMarksByGroup> = ({ marksForSubject }) => {
2222
if (!marksForSubject) {
23-
return NoData
23+
return <NoData />
2424
}
2525

2626
const subjectMarksMap = createSubjectMarksMap(marksForSubject)

src/components/UI/Marks/MarksList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC } from 'react'
2-
import { AbsenceTypes, Grade } from 'diary-shared'
2+
import { AbsenceTypes, Grade } from '@diary-spo/shared'
33
import Mark from '../Mark'
44
import { SubjectMarksMap } from '@utils'
55

src/components/UI/MarksByDay/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FunctionalComponent } from 'preact'
22
import { HorizontalScroll } from '@vkontakte/vkui'
3-
import { PerformanceCurrent } from 'diary-shared'
3+
import { PerformanceCurrent } from '@diary-spo/shared'
44
import { extractMarksByDay, sortByDay } from '@utils'
55
import { memo } from 'preact/compat'
66
import LessonGrades, { ILessonGrades } from './LessonGrades'

src/components/UserInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Icon20RefreshOutline, Icon28SchoolOutline } from '@vkontakte/icons'
1616

1717
import bridge from '@vkontakte/vk-bridge'
1818
// import { useRouteNavigator } from '@vkontakte/vk-mini-apps-router'
19-
// import { Organization } from 'diary-shared';
19+
// import { Organization } from '@diary-spo/shared';
2020
// import { useRateLimitExceeded } from '../hooks'
2121
// import { MODAL_COLLEGE_INFO } from '../modals/ModalRoot'
2222
// import { getCollegeInfo } from '../methods'

src/methods/server/getAds.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NotificationsResponse } from 'diary-shared'
1+
import { NotificationsResponse } from '@diary-spo/shared'
22
import makeRequest from './makeRequest'
33

44
export const getAds = async (): Promise<NotificationsResponse[] | 418 | 429> =>

src/methods/server/getAttestation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AttestationResponse } from 'diary-shared'
1+
import { AttestationResponse } from '@diary-spo/shared'
22
import makeRequest from './makeRequest'
33

44
export const getAttestation = async (): Promise<

src/methods/server/getCollegeInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Organization } from 'diary-shared'
1+
import { Organization } from '@diary-spo/shared'
22
import makeRequest from './makeRequest'
33

44
export const getCollegeInfo = async (): Promise<Organization | 418 | 429> =>

src/methods/server/getLessons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Day } from 'diary-shared'
1+
import { Day } from '@diary-spo/shared'
22
import { formatDateForRequest } from '@utils'
33
import makeRequest from './makeRequest'
44

src/methods/server/getPerformance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PerformanceCurrent } from 'diary-shared'
1+
import { PerformanceCurrent } from '@diary-spo/shared'
22
import makeRequest from './makeRequest'
33

44
export const getPerformance = async (): Promise<

src/modals/LessonModal/LessonGrade.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { FC } from 'preact/compat'
22
import { Group, Header, SimpleCell } from '@vkontakte/vkui'
3-
import { AbsenceTypes, AbsenceTypesDescription, Lesson } from 'diary-shared'
3+
import {
4+
AbsenceTypes,
5+
AbsenceTypesDescription,
6+
Lesson,
7+
} from '@diary-spo/shared'
48
import { Mark, ExplanationTooltip } from '@components'
59
import LessonTasks from './LessonTasks'
610

src/modals/LessonModal/LessonMainInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FC } from 'react'
22
import { Group, Header, InfoRow, SimpleCell } from '@vkontakte/vkui'
3-
import { LessonWorkType, TLesson } from 'diary-shared'
3+
import { LessonWorkType, TLesson } from '@diary-spo/shared'
44
import { ExplanationTooltip } from '@components'
55
import { textToLink } from '@utils'
66

src/modals/LessonModal/LessonTasks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FC } from 'react'
2-
import { Lesson, LessonType } from 'diary-shared'
2+
import { Lesson, LessonType } from '@diary-spo/shared'
33
import { InfoRow, Separator, SimpleCell, Spacing, Text } from '@vkontakte/vkui'
44
import { Mark } from '@components'
55
import { setDefaultMark } from '@utils'

src/modals/LessonModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ModalPage, ModalPageHeader } from '@vkontakte/vkui'
2-
import { Lesson } from 'diary-shared'
2+
import { Lesson } from '@diary-spo/shared'
33
import { FC } from 'preact/compat'
44
import { useEffect, useState } from 'preact/hooks'
55
import LessonMainInfo, { ILessonMainInfo } from './LessonMainInfo'

src/modals/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Lesson } from 'diary-shared'
1+
import { Lesson } from '@diary-spo/shared'
22

33
export const cleanData: Lesson = {
44
name: '',

src/store/useModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useSyncExternalStore } from 'react'
2-
import { Lesson } from 'diary-shared'
2+
import { Lesson } from '@diary-spo/shared'
33
import { cleanData } from '../modals/data'
44
import createStore from './index'
55

src/utils/formatted/formatStatisticsData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Grade, PerformanceCurrent, TextMark } from 'diary-shared'
1+
import { Grade, PerformanceCurrent, TextMark } from '@diary-spo/shared'
22

33
/**
44
* Функция 'formatStatisticsData' обрабатывает данные оценок, вычисляя статистику на их основе.

src/utils/marks/calculateAverageMark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Grade, TextMark } from 'diary-shared'
1+
import { Grade, TextMark } from '@diary-spo/shared'
22

33
/**
44
* Функция 'calculateAverageMark' высчитывает средний балл учащегося до двух знаков после запятой.

src/utils/marks/createSubjectMarksMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AbsenceType, PerformanceCurrent, TextMark } from 'diary-shared'
1+
import { AbsenceType, PerformanceCurrent, TextMark } from '@diary-spo/shared'
22

33
export interface SubjectMarksMap {
44
[subjectName: string]: {

src/utils/marks/extractMarksByDay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Grade, PerformanceCurrent } from 'diary-shared'
1+
import { Grade, PerformanceCurrent } from '@diary-spo/shared'
22
import { IMarksByDay } from '@components'
33

44
/**

src/utils/marks/setDefaultMark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Grade, Task, TextMark } from 'diary-shared'
1+
import { Grade, Task, TextMark } from '@diary-spo/shared'
22

33
export type ReturnedMark = TextMark | 'Н' | 'ДЗ' | 'О' | 'Д' | number
44

src/utils/setLessonDetails.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Lesson } from 'diary-shared'
1+
import { Lesson, LessonWorkTypeKeys } from '@diary-spo/shared'
22
import { formatLessonName } from './formatted/formatLessonName'
33

44
/**
@@ -28,7 +28,7 @@ export const setLessonDetails = (lesson: Lesson) => {
2828
gradebook: {
2929
absenceType: gradebook?.absenceType,
3030
id: gradebook?.id || 0,
31-
lessonType: gradebook?.lessonType || 'Не задан',
31+
lessonType: gradebook?.lessonType || ('Не задан' as LessonWorkTypeKeys),
3232
tasks: tasksArray,
3333
themes: gradebook?.themes,
3434
},

src/views/Attestation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
Panel,
77
Placeholder,
88
} from '@vkontakte/vkui'
9-
import { AttestationResponse } from 'diary-shared'
9+
import { AttestationResponse } from '@diary-spo/shared'
1010
import { FC, lazy } from 'preact/compat'
1111
import { useCallback, useEffect, useState } from 'preact/hooks'
1212
import { PanelHeaderWithBack } from '@components'

src/views/LoginForm.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
Icon28DoorArrowLeftOutline,
1414
Icon28ErrorCircleOutline,
1515
} from '@vkontakte/icons'
16-
import { AuthData } from 'diary-shared'
16+
import { AuthData } from '@diary-spo/shared'
1717
import { useEffect, useState } from 'preact/hooks'
1818
import { ChangeEvent, FC } from 'preact/compat'
1919
import { PanelHeaderWithBack } from '@components'
@@ -166,14 +166,14 @@ const LoginForm: FC<{ id: string }> = ({ id }) => {
166166
const loginTopText = isLoginEmpty
167167
? 'Логин'
168168
: loginPattern.test(login)
169-
? 'Логин введён'
170-
: 'Введите корректный логин'
169+
? 'Логин введён'
170+
: 'Введите корректный логин'
171171
const passwordTopText =
172172
password === ''
173173
? 'Пароль'
174174
: isPasswordValid
175-
? 'Пароль введён'
176-
: 'Введите корректный пароль'
175+
? 'Пароль введён'
176+
: 'Введите корректный пароль'
177177

178178
return (
179179
<Panel nav={id}>
@@ -194,8 +194,8 @@ const LoginForm: FC<{ id: string }> = ({ id }) => {
194194
isLoginEmpty
195195
? 'default'
196196
: loginPattern.test(login)
197-
? 'valid'
198-
: 'error'
197+
? 'valid'
198+
: 'error'
199199
}
200200
bottom={isLoginEmpty || loginTopText}
201201
bottomId="login-type"

src/views/Marks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Group, Panel, PanelSpinner, PullToRefresh } from '@vkontakte/vkui'
22
import { Icon28ErrorCircleOutline, Icon28InfoCircle } from '@vkontakte/icons'
3-
import { PerformanceCurrent } from 'diary-shared'
3+
import { PerformanceCurrent } from '@diary-spo/shared'
44
import { FC } from 'preact/compat'
55
import { useEffect, useState } from 'preact/hooks'
66
import {

src/views/Notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Title,
1515
} from '@vkontakte/vkui'
1616
import { Icon28ErrorCircleOutline } from '@vkontakte/icons'
17-
import { NotificationsResponse } from 'diary-shared'
17+
import { NotificationsResponse } from '@diary-spo/shared'
1818
import { useEffect, useState } from 'preact/hooks'
1919
import { FC } from 'preact/compat'
2020
import { PanelHeaderWithBack, SubtitleWithBorder } from '@components'

src/views/Schedule.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
Icon24ChevronRightCircle,
2424
} from '@vkontakte/icons'
2525
import { addDays, endOfWeek, startOfWeek } from '@vkontakte/vkui/dist/lib/date'
26-
import { Day, PerformanceCurrent } from 'diary-shared'
26+
import { Day, PerformanceCurrent } from '@diary-spo/shared'
2727
import { getLessons, getPerformance } from '../methods'
2828
import { ExplanationTooltip, PanelHeaderWithBack, Suspense } from '@components'
2929
import {

0 commit comments

Comments
 (0)