Skip to content

Commit 398e607

Browse files
authored
Merge pull request #24 from LexaFrontDev/dev
Dev
2 parents 1f6d902 + b847154 commit 398e607

23 files changed

Lines changed: 194 additions & 37 deletions

File tree

.env

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
APP_ENV=dev
2-
APP_SECRET=25aeff0645dafb0ce3dc54218fd03bed
2+
APP_SECRET=
33

44
DATABASE_URL="pgsql://TimerAppUser:user123@db:5432/TimerAppDatabase?serverVersion=13&charset=utf8"
5-
5+
API_KEY=
6+
AI_MODEL=
7+
AI_URL=
68

79

810
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
@@ -22,9 +24,19 @@ JWT_PUBLIC_KEY_PATH=%kernel.project_dir%/config/jwt/public.pem
2224
JWT_PASSPHRASE=
2325
###< lexik/jwt-authentication-bundle ###
2426

25-
VITE_CACHE_DB_NAME=HabitAiCacheDev
26-
VITE_CACHE_STORE_NAME=cache
27-
VITE_GOOGLE_CLIENT_ID=643971601411-
27+
VITE_CACHE_DB_NAME=
28+
VITE_CACHE_STORE_NAME=
29+
VITE_GOOGLE_CLIENT_ID=
2830
VITE_GOOGLE_REDIRECT_URI=
2931
VITE_PUSH_PUBLIC_KEY=
3032
VITE_PUSH_PRIVATE_KEY=
33+
34+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
35+
36+
MAILER_DSN=null://null
37+
38+
MERCURE_URL=https://example.com/.well-known/mercure
39+
40+
MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure
41+
42+
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package-lock.json
1010
/public/bundles/
1111
/var/
1212
/vendor/
13+
/ignorefiles
1314
###< symfony/framework-bundle ###
1415

1516
###> phpunit/phpunit ###

assets/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ import './bootstrap.js';
77
*/
88
import './styles/app.scss';
99

10-
console.log('This log comes from assets/app.js - welcome to AssetMapper! 🎉');
10+

assets/react/Router.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ const RouterDom = () => {
4141
try {
4242
const res = await fetch('/api/auth/check');
4343
const data = await res.json();
44-
console.log(data);
4544
const ok = res.ok;
4645
setIsAuthenticated(ok);
4746

4847
if(ok){
49-
console.log('Зов пениса');
5048
subscribePush();
5149
}
5250

@@ -83,7 +81,6 @@ const RouterDom = () => {
8381

8482

8583
const getPlatform = () => {
86-
console.log('Дошли')
8784
const ua = navigator.userAgent;
8885

8986
let os = 'Unknown OS';
@@ -100,7 +97,6 @@ const RouterDom = () => {
10097
else if (/Safari/.test(ua) && !/Chrome/.test(ua)) browser = 'Safari';
10198
else if (/Edg/.test(ua)) browser = 'Edge';
10299
else if (/OPR/.test(ua)) browser = 'Opera';
103-
console.log('тоже')
104100
return `${browser}_${os}`;
105101
};
106102

@@ -121,9 +117,7 @@ const RouterDom = () => {
121117
return;
122118
}
123119
}
124-
console.log('Service Worker зарегистрирован:');
125120
const registration = await navigator.serviceWorker.register('/serviceWorker/ServiceWorker.js');
126-
console.log('Service Worker зарегистрирован:', registration);
127121

128122
const subscription = await registration.pushManager.subscribe({
129123
userVisibleOnly: true,
@@ -136,7 +130,7 @@ const RouterDom = () => {
136130
keys: subscription.toJSON().keys
137131
};
138132

139-
console.log('Отправляем данные подписки:', pushData);
133+
140134

141135
await fetch('/api/save/subscription/web', {
142136
method: 'POST',

assets/react/Services/Ctn/RequestServices.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,29 @@ export class RequestServices {
2424
return response.json() as Promise<R>;
2525
}
2626

27-
async get<R>(fetchUrl: string, method: string = "GET", body?: any, accessMassiveKey?: string): Promise<R[] | R | false> {
27+
async get<R>(fetchUrl: string, method: string = "GET", body?: any): Promise<R | false> {
28+
try {
29+
const data = await this._request<R>(fetchUrl, method, method !== "GET" ? body : undefined);
30+
return data;
31+
} catch (e) {
32+
await this.logError("Ошибка GET-запроса", { fetchUrl, error: e });
33+
return false;
34+
}
35+
}
36+
37+
async getArray<R>(fetchUrl: string, method: string = "GET", body?: any, accessMassiveKey?: string): Promise<R[] | false> {
2838
try {
2939
let data = await this._request<R | R[]>(fetchUrl, method, method !== "GET" ? body : undefined);
3040

3141
if (accessMassiveKey && typeof data === "object" && !Array.isArray(data)) {
3242
data = (data as any)[accessMassiveKey];
3343
}
3444

45+
if (!Array.isArray(data)) {
46+
if (data == null) return [];
47+
return [data as R];
48+
}
49+
3550
return data;
3651
} catch (e) {
3752
await this.logError("Ошибка GET-запроса", { fetchUrl, error: e });

assets/react/Services/Habits/HabitsPageLogic.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const useHabitsLogic = (habitsService: HabitsService) => {
4444
return setHabits([]);
4545
}
4646
setIsLoading(false);
47-
setHabits(result || []);
47+
setHabits(result);
4848
};
4949

5050
const fetchHabitsStatistic = async () => {
@@ -56,7 +56,6 @@ export const useHabitsLogic = (habitsService: HabitsService) => {
5656
}
5757

5858

59-
console.log(statistic)
6059
setIsLoading(false);
6160
setHabitsStatistic(statistic || [])
6261
}
@@ -71,7 +70,7 @@ export const useHabitsLogic = (habitsService: HabitsService) => {
7170
}
7271

7372
setIsLoading(false);
74-
setTemplates(templates || [])
73+
setTemplates(templates)
7574
}
7675

7776
const saveHabitProgress = async (habitId: number, countProgress: number) => {

assets/react/Services/Habits/HabitsService.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ export class HabitsService {
4444
}
4545

4646

47-
async getHabitsAll(limit: number = 50, offset: number = 0): Promise<DataType[] | false | DataType> {
48-
return await this.reqService.get<DataType>(`habits`, `/api/get/Habits/all?limit=${limit}&offset=${offset}`, 'GET');
47+
async getHabitsAll(limit: number = 50, offset: number = 0): Promise<DataType[] | false> {
48+
return await this.reqService.getArray<DataType>(`habits`, `/api/get/Habits/all?limit=${limit}&offset=${offset}`, 'GET');
4949
}
5050

51-
async getHabitsTemplatesAll(): Promise<HabitTemplate[] | false | HabitTemplate>{
52-
return await this.reqService.get<HabitTemplate>(`habits_templates`, `/api/Habits/templates/all`, 'GET');
51+
async getHabitsTemplatesAll(): Promise<HabitTemplate[] | false>{
52+
return await this.reqService.getArray<HabitTemplate>(`habits_templates`, `/api/Habits/templates/all`, 'GET');
5353
}
5454

5555
async getHabitsStatisticAll(): Promise<any | false>{

assets/react/Services/Pomodoro/PomodoroTimer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const usePomodoroTimer = (PomodoroUseCase: PomodoroService) => {
105105
timeEnd: Math.floor(Date.now() / 1000),
106106
created_date: Math.floor(Date.now() / 1000),
107107
};
108-
console.log(pomodoroData);
108+
109109
await PomodoroUseCase.createPomodro(pomodoroData);
110110
}
111111

assets/react/Services/Tasks/TasksService.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export class TasksService {
2727
'/api/list/tasks/all',
2828
'GET',
2929
undefined,
30-
'result'
3130
);
3231

3332
return response;

assets/react/pages/Pomodor/PomodoroPage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ const langUseCase = new LangStorageUseCase(langStorage);
3030

3131

3232
const Pomodoro = () => {
33-
const [dataPomodoro, setDataPomodoro] = useState<PomodoroData | null>(null);
33+
const [dataPomodoro, setDataPomodoro] = useState<PomodoroData>({
34+
todayPomos: 0,
35+
todayFocusTime: 0,
36+
totalPomodorCount: 0,
37+
habitsList: [],
38+
tasksList: [],
39+
pomodorHistory: [],
40+
});
41+
3442
const [activeTab, setActiveTab] = useState('Pomodoro');
3543
const [langCode, setLangCode] = useState('en');
3644
const { t, i18n } = useTranslation('translation');
@@ -97,7 +105,7 @@ const Pomodoro = () => {
97105
};
98106

99107

100-
if (!translationsLoaded || !dataPomodoro) return <Loading />;
108+
if (!translationsLoaded) return <Loading />;
101109

102110

103111
const { todayPomos, todayFocusTime, totalPomodorCount, habitsList, tasksList, pomodorHistory } = dataPomodoro;

0 commit comments

Comments
 (0)