|
|
@@ -1,7 +1,9 @@
|
|
|
import React from 'react';
|
|
|
+
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
+
|
|
|
import { useSWRxCurrentPage } from '~/stores/page';
|
|
|
import { useXss } from '~/stores/xss';
|
|
|
-import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
|
export const PageGrantAlert = (): JSX.Element => {
|
|
|
@@ -9,32 +11,32 @@ export const PageGrantAlert = (): JSX.Element => {
|
|
|
const { data: pageData } = useSWRxCurrentPage();
|
|
|
const { data: xss } = useXss();
|
|
|
|
|
|
- if ( pageData == null || pageData.grant == null || pageData.grant == 1 || xss == null) {
|
|
|
- return <></>
|
|
|
+ if (pageData == null || pageData.grant == null || pageData.grant === 1 || xss == null) {
|
|
|
+ return <></>;
|
|
|
}
|
|
|
|
|
|
const renderAlertContent = () => {
|
|
|
const getGrantLabel = () => {
|
|
|
- if (pageData.grant == 2) {
|
|
|
+ if (pageData.grant === 2) {
|
|
|
return (
|
|
|
<>
|
|
|
<i className="icon-fw icon-link"></i><strong>{t('Anyone with the link')} only</strong>
|
|
|
</>
|
|
|
- )
|
|
|
+ );
|
|
|
}
|
|
|
- if (pageData.grant == 4) {
|
|
|
+ if (pageData.grant === 4) {
|
|
|
return (
|
|
|
<>
|
|
|
<i className="icon-fw icon-lock"></i><strong>{t('Only me')} only</strong>
|
|
|
</>
|
|
|
- )
|
|
|
+ );
|
|
|
}
|
|
|
- if (pageData.grant == 5) {
|
|
|
+ if (pageData.grant === 5) {
|
|
|
return (
|
|
|
<>
|
|
|
<i className="icon-fw icon-organization"></i><strong>{xss.process(pageData.grantedGroup.name)} only</strong>
|
|
|
</>
|
|
|
- )
|
|
|
+ );
|
|
|
}
|
|
|
};
|
|
|
return (
|
|
|
@@ -50,4 +52,4 @@ export const PageGrantAlert = (): JSX.Element => {
|
|
|
{renderAlertContent()}
|
|
|
</p>
|
|
|
);
|
|
|
-}
|
|
|
+};
|