Skip to content

Commit d11ef2d

Browse files
authored
fix: all minor bugs (#1379)
* fix: all bugs * fix: all bugs * fix: all bugs * fix: all bugs * fix: all bugs
1 parent c81306c commit d11ef2d

File tree

21 files changed

+90
-71
lines changed

21 files changed

+90
-71
lines changed

apps/web/next.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const nextConfig = {
1212
output: 'standalone',
1313
eslint: { ignoreDuringBuilds: true },
1414
transpilePackages: ['@ufb/react'],
15+
compiler: { removeConsole: process.env.NODE_ENV === 'production' },
1516
images: { remotePatterns: [{ hostname: '*' }] },
1617
webpack(config) {
1718
// @ts-ignore

apps/web/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"i18next": "^24.0.0",
5858
"immer": "^10.0.4",
5959
"jwt-decode": "^4.0.0",
60-
"lz-string": "^1.5.0",
6160
"next": "^15.0.0",
6261
"next-i18next": "^15.3.0",
6362
"next-themes": "^0.4.3",

apps/web/src/entities/feedback/lib/use-feedback-query-converter.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import { useCallback, useMemo, useState } from 'react';
1818
import dayjs from 'dayjs';
19-
import { compressToBase64, decompressFromBase64 } from 'lz-string';
2019
import { createParser, useQueryState } from 'nuqs';
2120

2221
import type {
@@ -73,13 +72,10 @@ const useFeedbackQueryConverter = (input: {
7372
'queries',
7473
createParser({
7574
parse: (value) => {
76-
return JSON.parse(decompressFromBase64(value)) as Record<
77-
string,
78-
unknown
79-
>[];
75+
return JSON.parse(atob(value)) as Record<string, unknown>[];
8076
},
8177
serialize: (value) => {
82-
return compressToBase64(JSON.stringify(value));
78+
return btoa(JSON.stringify(value));
8379
},
8480
}).withDefault([{ createdAt: DEFAULT_DATE_RANGE, condition: 'IS' }]),
8581
);

apps/web/src/entities/feedback/ui/feedback-detail-sheet.ui.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
import { useState } from 'react';
1818
import { useOverlay } from '@toss/use-overlay';
1919
import dayjs from 'dayjs';
20-
import { compressToBase64 } from 'lz-string';
2120
import { useTranslation } from 'next-i18next';
2221

2322
import {
2423
Button,
2524
Divider,
25+
Icon,
2626
Sheet,
2727
SheetBody,
2828
SheetClose,
@@ -31,6 +31,7 @@ import {
3131
SheetHeader,
3232
SheetTitle,
3333
Tag,
34+
toast,
3435
} from '@ufb/react';
3536

3637
import {
@@ -80,7 +81,12 @@ const FeedbackDetailSheet = (props: Props) => {
8081

8182
const onClickSubmit = async () => {
8283
const editedFeedback = fields
83-
.filter((v) => v.property === 'EDITABLE' && v.status === 'ACTIVE')
84+
.filter(
85+
(v) =>
86+
v.property === 'EDITABLE' &&
87+
v.status === 'ACTIVE' &&
88+
v.format !== 'images',
89+
)
8490
.reduce((acc, cur) => {
8591
if (cur.key === 'issues') return acc;
8692
if (cur.format === 'date') {
@@ -92,11 +98,13 @@ const FeedbackDetailSheet = (props: Props) => {
9298
: null,
9399
};
94100
}
95-
return acc;
101+
return {
102+
...acc,
103+
[cur.key]: currentFeedback[cur.key] ?? null,
104+
};
96105
}, {} as Feedback);
97106

98107
try {
99-
setIsLoading(true);
100108
await updateFeedback?.(editedFeedback);
101109
} finally {
102110
setIsLoading(false);
@@ -128,11 +136,14 @@ const FeedbackDetailSheet = (props: Props) => {
128136
variant="outline"
129137
size="small"
130138
className="cursor-pointer"
131-
onClick={() =>
132-
navigator.clipboard.writeText(
133-
`${window.location.origin}/${window.location.pathname}?queries=${compressToBase64(JSON.stringify([{ id: feedback.id, condition: 'IS' }]))}&channelId=${channelId}`,
134-
)
135-
}
139+
onClick={async () => {
140+
await navigator.clipboard.writeText(
141+
`${window.location.origin}/${window.location.pathname}?queries=${btoa(JSON.stringify([{ id: feedback.id, condition: 'IS' }]))}&channelId=${channelId}`,
142+
);
143+
toast(t('v2.toast.copy'), {
144+
icon: <Icon name="RiCheckboxMultipleFill" />,
145+
});
146+
}}
136147
>
137148
URL Copy
138149
</Tag>

apps/web/src/entities/user/ui/user-management-table.ui.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ const UserManagementTable: React.FC<IProps> = ({ createButton }) => {
149149
setRowCount(userData?.meta.totalItems ?? 0);
150150
}, [userData, pagination, isLoading]);
151151

152+
useEffect(() => {
153+
table.setPageIndex(0);
154+
table.resetRowSelection();
155+
}, [pagination.pageSize]);
156+
152157
const selectedRowIds = useMemo(() => {
153158
return Object.entries(table.getState().rowSelection).reduce(
154159
(acc, [key, value]) => (value ? acc.concat(Number(key)) : acc),

apps/web/src/entities/user/user.model.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,18 @@ export const useUserStore = create<State & Action>((set, get) => ({
8181
}
8282
},
8383
async _signIn(jwt) {
84-
await cookieStorage.setItem('jwt', jwt);
85-
const broadcastChannel = new BroadcastChannel('ufb');
86-
broadcastChannel.postMessage({ type: 'reload', payload: get().randomId });
87-
get().setUser();
88-
if (router.query.callback_url) {
89-
await router.push(router.query.callback_url as string);
90-
} else {
91-
await router.push({ pathname: Path.MAIN });
84+
try {
85+
await cookieStorage.setItem('jwt', jwt);
86+
const broadcastChannel = new BroadcastChannel('ufb');
87+
broadcastChannel.postMessage({ type: 'reload', payload: get().randomId });
88+
get().setUser();
89+
if (router.query.callback_url) {
90+
await router.push(router.query.callback_url as string);
91+
} else {
92+
await router.push({ pathname: Path.MAIN });
93+
}
94+
} catch (error) {
95+
console.log('error: ', error);
9296
}
9397
},
9498
}));

apps/web/src/features/auth/reset-password-with-email/ui/request-reset-password-with-email.ui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const RequestResetPasswordWithEmail: React.FC<IProps> = () => {
4444
queryOptions: {
4545
async onSuccess() {
4646
await router.push(Path.SIGN_IN);
47-
toast.success('Success');
47+
toast.success(t('v2.toast.success'));
4848
},
4949
},
5050
});

apps/web/src/features/auth/reset-password-with-email/ui/reset-password-with-email-form.ui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const ResetPasswordWithEmailForm: React.FC<IProps> = ({ code, email }) => {
4646
path: '/api/admin/users/password/reset',
4747
queryOptions: {
4848
async onSuccess() {
49-
toast.success('Success');
49+
toast.success(t('v2.toast.success'));
5050
await router.push(Path.SIGN_IN);
5151
},
5252
},

apps/web/src/features/auth/sign-up-with-email/sign-up-with-email.schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const signUpWithEmailSchema = z
2525
confirmPassword: z.string().min(8),
2626
})
2727
.refine((schema) => schema.password === schema.confirmPassword, {
28-
message: 'Password not matched',
28+
message: 'must equal Password',
2929
path: ['confirmPassword'],
3030
})
3131
.refine(({ password }) => /[a-zA-Z!@#$%^&*(),.?":{}|<>]/.test(password), {
@@ -34,5 +34,5 @@ export const signUpWithEmailSchema = z
3434
})
3535
.refine(({ password }) => !/(.)\1/.test(password), {
3636
message: 'must not contain consecutive identical characters',
37-
path: ['newPassword'],
37+
path: ['password'],
3838
});

apps/web/src/features/auth/sign-up-with-email/ui/sign-up-with-email-form.ui.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const SignUpWithEmailForm: React.FC<IProps> = (props) => {
5656
{ ...initialValues }
5757
: { emailState: 'NOT_VERIFIED', code: '' },
5858
});
59-
console.log('formState: ', formState.errors);
6059

6160
const [expiredTime, setExpiredTime] = useState<string>();
6261
const [leftTime, setLeftTime] = useState('');

0 commit comments

Comments
 (0)