Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e95b38b
#175222-175223 修正-ファイル選択されていないときにはボタンがdisabledになるようにしました。
hikaru-n-cpu Dec 4, 2025
7957f36
Merge branch 'dev/7.4.x' into fix/disable-logo-update-without-file
hikaru-n-cpu Dec 9, 2025
5178bed
#175222-175223 修正-更新ボタンの動作完成
hikaru-n-cpu Dec 9, 2025
27f2c8c
Merge branch 'dev/7.4.x' into fix/disable-logo-update-without-file
hikaru-n-cpu Dec 10, 2025
a64101e
fix # 175223 Reset file selection state after custom logo deletion
hikaru-n-cpu Dec 10, 2025
2959b16
Merge branch 'dev/7.4.x' into fix/disable-logo-update-without-file
hikaru-n-cpu Dec 11, 2025
a0e936d
fix: deprecation of isFileSelected
hikaru-n-cpu Dec 16, 2025
746887d
Fix: Prevent accidental file input reset after successful image crop
hikaru-n-cpu Dec 17, 2025
38419dc
Fix: Remove disabled state from file input
hikaru-n-cpu Dec 17, 2025
6494810
Fix: Correct logic for logo upload cleanup and stabilize dependencies
hikaru-n-cpu Dec 17, 2025
1e65d48
Fix: Remove unnecessary dependency onModalCloseHandler from useCallback
hikaru-n-cpu Dec 18, 2025
667dbbc
fix: fixed key reset function
hikaru-n-cpu Dec 25, 2025
c28d194
putting together the logic for onModalClose
hikaru-n-cpu Dec 25, 2025
b8029eb
Merge branch 'dev/7.4.x' into fix/disable-logo-update-without-file
hikaru-n-cpu Jan 6, 2026
27f30ad
imprv #175223 修正 -fbの修正完了
hikaru-n-cpu Jan 6, 2026
83b53ce
lint_errorの修正
hikaru-n-cpu Jan 7, 2026
c8463d0
refactor #175223 improve update button disable logic
hikaru-n-cpu Jan 8, 2026
05fc447
imprv: #175223 simplifying success and failure handling when closing …
hikaru-n-cpu Jan 8, 2026
18b5212
fix_lint_error
hikaru-n-cpu Jan 8, 2026
3eab2e4
imprv: #175223 fixed a case where resetFileSelectionState was not bei…
hikaru-n-cpu Jan 8, 2026
1fd5e0e
imprv #175223 FBの対応
hikaru-n-cpu Jan 13, 2026
ecec814
imprv #175223 revision of feedback
hikaru-n-cpu Jan 13, 2026
a287d9d
Merge branch 'master' into fix/disable-logo-update-without-file
hikaru-n-cpu Jan 13, 2026
4f9ee8e
imprv #175223 fix-conflict
hikaru-n-cpu Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { type JSX, useCallback, useState } from 'react';
import React, { type JSX, useCallback, useRef, useState } from 'react';
import { useAtomValue, useSetAtom } from 'jotai';
import { useTranslation } from 'react-i18next';

Expand Down Expand Up @@ -32,12 +32,22 @@ const CustomizeLogoSetting = (): JSX.Element => {
isDefaultLogo ?? true,
);
const [retrieveError, setRetrieveError] = useState<any>();
const fileInputRef = useRef<HTMLInputElement | null>(null);
const isSystemError: boolean = retrieveError != null;
const isLogoSettingIncomplete: boolean =
!isDefaultLogoSelected &&
uploadLogoSrc == null &&
!isCustomizedLogoUploaded;
const isUpdateButtonDisabled: boolean =
isSystemError || isLogoSettingIncomplete;

const onSelectFile = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
if (e.target.files != null && e.target.files.length > 0) {
const files: FileList | null = e.target.files;

if (files != null && files.length > 0) {
const reader = new FileReader();
reader.addEventListener('load', () => setUploadLogoSrc(reader.result));
reader.readAsDataURL(e.target.files[0]);
reader.readAsDataURL(files[0]);
setIsImageCropModalShow(true);
}
}, []);
Expand All @@ -58,6 +68,26 @@ const CustomizeLogoSetting = (): JSX.Element => {
}
}, [t, isDefaultLogoSelected]);

const clearFileInput = useCallback(() => {
if (fileInputRef.current) {
fileInputRef.current.value = '';
}
}, []);

const resetFileSelectionState = useCallback(() => {
clearFileInput();
setUploadLogoSrc(null);
}, [clearFileInput]);

const onModalStateClose = useCallback(() => {
setIsImageCropModalShow(false);
}, []);

const onCloseCropModal = useCallback(() => {
resetFileSelectionState();
onModalStateClose();
}, [resetFileSelectionState, onModalStateClose]);

const onClickDeleteBtn = useCallback(async () => {
try {
await apiv3Delete('/customize-setting/delete-brand-logo');
Expand All @@ -68,19 +98,21 @@ const CustomizeLogoSetting = (): JSX.Element => {
ns: 'commons',
}),
);
resetFileSelectionState();
} catch (err) {
toastError(err);
setRetrieveError(err);
throw new Error('Failed to delete logo');
}
}, [setIsCustomizedLogoUploaded, t]);
}, [setIsCustomizedLogoUploaded, t, resetFileSelectionState]);

const processImageCompletedHandler = useCallback(
async (croppedImage) => {
try {
const formData = new FormData();
formData.append('file', croppedImage);
await apiv3PostForm('/customize-setting/upload-brand-logo', formData);
setIsImageCropModalShow(false);
setIsCustomizedLogoUploaded(true);
toastSuccess(
t('toaster.update_successed', {
Expand Down Expand Up @@ -196,14 +228,15 @@ const CustomizeLogoSetting = (): JSX.Element => {
onChange={onSelectFile}
name="brandLogo"
accept="image/*"
ref={fileInputRef}
/>
</div>
</div>
</div>
</div>
<AdminUpdateButtonRow
onClick={onClickSubmit}
disabled={retrieveError != null}
disabled={isUpdateButtonDisabled}
/>
</div>
</div>
Expand All @@ -212,7 +245,7 @@ const CustomizeLogoSetting = (): JSX.Element => {
<ImageCropModal
isShow={isImageCropModalShow}
src={uploadLogoSrc}
onModalClose={() => setIsImageCropModalShow(false)}
onModalClose={onCloseCropModal}
onImageProcessCompleted={processImageCompletedHandler}
isCircular={false}
showCropOption={false}
Expand Down
2 changes: 0 additions & 2 deletions apps/app/src/client/components/Common/ImageCropModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,13 @@ const ImageCropModal: FC<Props> = (props: Props) => {
// Save image to database
onImageProcessCompleted(processedImage);
}
onModalCloseHandler();
}, [
imageRef,
cropOptions,
isCropImage,
getCroppedImg,
convertBase64ToBlob,
onImageProcessCompleted,
onModalCloseHandler,
]);

const toggleCropMode = useCallback(
Expand Down
Loading