Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imprv: Corrected wording on admin page (/admin/data-transfer) #9098

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/en_US/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@
"publish_transfer_key": "Publish transfer key",
"transfer_key_limit": "Transfer keys are valid for 1 hour after issuance.",
"once_transfer_key_used": "Once the transfer key is used for transfer, it cannot be used for any other transfer.",
"transfer_to_growi_cloud": "If you wish to transfer to GROWI.cloud, please click here."
"transfer_to_growi_cloud": "For more details, please click <a href='https://{{growiHelpDomain}}/ja/admin-guide/management-cookbook/g2g-transfer.html'>here.</a>"
}
}
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/fr_FR/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@
"publish_transfer_key": "Publier la clé de transfert",
"transfer_key_limit": "Les clés de transfert sont valides durant une heure.",
"once_transfer_key_used": "Les clés de transfert sont à usage unique.",
"transfer_to_growi_cloud": "Si vous souhaitez transférer depuis GROWI.cloud, cliquez ici."
"transfer_to_growi_cloud": "Pour plus de détails, veuillez cliquer <a href='https://{{growiHelpDomain}}/ja/admin-guide/management-cookbook/g2g-transfer.html'>ici.</a>"
}
}
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/ja_JP/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@
"publish_transfer_key": "移行キーを発行する",
"transfer_key_limit": "※ 移行キーの有効期限は発行から1時間となります。",
"once_transfer_key_used": "※ 移行キーは一度移行に利用するとそれ以降はご利用いただけなくなります。",
"transfer_to_growi_cloud": "※ GROWI.cloud への移行を実施する場合はこちらをご確認ください。"
"transfer_to_growi_cloud": "※ 詳しくは <a href='https://{{growiHelpDomain}}/ja/admin-guide/management-cookbook/g2g-transfer.html'>こちら</a>"
}
}
2 changes: 1 addition & 1 deletion apps/app/public/static/locales/zh_CN/commons.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,6 @@
"publish_transfer_key": "发布迁移密钥",
"transfer_key_limit": "迁移密钥在签发后一小时内有效。",
"once_transfer_key_used": "一旦迁移密钥被用于迁移,它将不再可用于进一步的迁移。",
"transfer_to_growi_cloud": "如果您希望迁移到GROWI.cloud,请点击这里。"
"transfer_to_growi_cloud": "有关更多详情,请点击<a href='https://{{growiHelpDomain}}/ja/admin-guide/management-cookbook/g2g-transfer.html'>此处</a>。"
}
}
6 changes: 5 additions & 1 deletion apps/app/src/client/components/Admin/G2GDataTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useGenerateTransferKey } from '~/client/services/g2g-transfer';
import { apiv3Get, apiv3Post } from '~/client/util/apiv3-client';
import { toastError, toastSuccess } from '~/client/util/toastr';
import { G2G_PROGRESS_STATUS, type G2GProgress } from '~/interfaces/g2g-transfer';
import { useGrowiHelpDomain } from '~/stores-universal/context';
import { useAdminSocket } from '~/stores/socket-io';

import CustomCopyToClipBoard from '../Common/CustomCopyToClipBoard';
Expand Down Expand Up @@ -123,6 +124,8 @@ const G2GDataTransfer = (): JSX.Element => {
}
}, [setTransferring, startTransferKey, selectedCollections, optionsMap]);

const { data: growiHelpDomain } = useGrowiHelpDomain();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このロジックは GROWI 全体で使えそうなロジックなので、useGrowiCloudUri と useGrowiAppIdForGrowiCloud を見て growi.cloud/help か docs.growi.org を返却してくれるカスタム Hook を作ったほうがいいかもしれません。

参考

https://github.com/weseek/growi/blob/e25be0382777e0100735252fb4d8d63288b4026c/apps/app/src/stores-universal/context.tsx#L211-L288

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

作成しました

// File upload
// const onChangeFileUploadTypeHandler = useCallback((e: ChangeEvent, type: string) => {
// setFileUploadType(type);
Expand Down Expand Up @@ -275,7 +278,8 @@ const G2GDataTransfer = (): JSX.Element => {
<div className="alert alert-warning mt-4">
<p className="mb-1">{t('commons:g2g_data_transfer.transfer_key_limit')}</p>
<p className="mb-1">{t('commons:g2g_data_transfer.once_transfer_key_used')}</p>
<p className="mb-0">{t('commons:g2g_data_transfer.transfer_to_growi_cloud')}</p>
{/* eslint-disable-next-line react/no-danger */}
<p className="mb-0" dangerouslySetInnerHTML={{ __html: t('commons:g2g_data_transfer.transfer_to_growi_cloud', { growiHelpDomain }) }} />
</div>
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion apps/app/src/client/components/DataTransferForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import React from 'react';
import { useTranslation } from 'next-i18next';

import { useGenerateTransferKey } from '~/client/services/g2g-transfer';
import { useGrowiHelpDomain } from '~/stores-universal/context';

import CustomCopyToClipBoard from './Common/CustomCopyToClipBoard';

const DataTransferForm = (): JSX.Element => {
const { t } = useTranslation('commons');
const { transferKey, generateTransferKey } = useGenerateTransferKey();
const { data: growiHelpDomain } = useGrowiHelpDomain();

return (
<div data-testid="installerForm" className="py-3 px-4">
Expand All @@ -33,7 +35,8 @@ const DataTransferForm = (): JSX.Element => {
<div className="alert alert-warning mt-4">
<p className="mb-1">{t('g2g_data_transfer.transfer_key_limit')}</p>
<p className="mb-1">{t('g2g_data_transfer.once_transfer_key_used')}</p>
<p className="mb-0">{t('g2g_data_transfer.transfer_to_growi_cloud')}</p>
{/* eslint-disable-next-line react/no-danger */}
<p className="mb-0" dangerouslySetInnerHTML={{ __html: t('g2g_data_transfer.transfer_to_growi_cloud', { growiHelpDomain }) }} />
</div>
</div>
);
Expand Down
15 changes: 15 additions & 0 deletions apps/app/src/stores-universal/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,18 @@ export const useAcceptedUploadFileType = (): SWRResponse<AcceptedUploadFileType,
},
);
};

export const useGrowiHelpDomain = (): SWRResponse<'growi.cloud/help' | 'docs.growi.org', Error> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help という文字が含まれていると GROWI.cloud の Help サイトっぽいニュアンスになるので useGrowiDocumentationUrl などはどうでしょうか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useGrowiDocumentationUrl
に変更しました

const { data: growiCloudUri } = useGrowiCloudUri();
const { data: growiAppIdForGrowiCloud } = useGrowiAppIdForGrowiCloud();

return useSWRImmutable(
[growiCloudUri, growiAppIdForGrowiCloud],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これより上に const key = "growiDocumentationUrl" のような key を作って useSWRImmutable の配列に入れるようにしてください

Copy link
Contributor Author

@shironegi39 shironegi39 Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他の Hook を見ると
['documentationUrl', growiCloudUri, growiAppIdForGrowiCloud]
でも行けそうなので、こちらに変更しました

([growiCloudUri, growiAppIdForGrowiCloud]) => {
if (growiCloudUri != null && growiAppIdForGrowiCloud != null) {
return 'growi.cloud/help';
}
return 'docs.growi.org';
},
);
};
Loading