diff --git a/dictation_client/src/AppRouter.tsx b/dictation_client/src/AppRouter.tsx index a3d4ffd..c337f86 100644 --- a/dictation_client/src/AppRouter.tsx +++ b/dictation_client/src/AppRouter.tsx @@ -16,6 +16,7 @@ import UserListPage from "pages/UserListPage"; import LicensePage from "pages/LicensePage"; import DictationPage from "pages/DictationPage"; import LicenseOrderHistoryPage from "pages/LicenseOrderHistoryPage"; +import PartnerPage from "pages/PartnerPage"; const AppRouter: React.FC = () => ( @@ -64,6 +65,10 @@ const AppRouter: React.FC = () => ( path="/workflow" element={} />} /> + } />} + /> } /> ); diff --git a/dictation_client/src/pages/PartnerPage/index.tsx b/dictation_client/src/pages/PartnerPage/index.tsx new file mode 100644 index 0000000..1b81e82 --- /dev/null +++ b/dictation_client/src/pages/PartnerPage/index.tsx @@ -0,0 +1,92 @@ +import { useMsal } from "@azure/msal-react"; +import { AppDispatch } from "app/store"; +import { UpdateTokenTimer } from "components/auth/updateTokenTimer"; +import Footer from "components/footer"; +import Header from "components/header"; +import { clearToken } from "features/auth"; +import React from "react"; +import { useDispatch } from "react-redux"; +import styles from "styles/app.module.scss"; +import { loadAccessToken, isApproveTier } from "features/auth/utils"; +import postAdd from "../../assets/images/post_add.svg"; +import { decodeToken } from "../../common/decodeToken"; +import { TIERS } from "../../components/auth/constants"; + +const PartnerPage: React.FC = (): JSX.Element => { + const { instance } = useMsal(); + const dispatch: AppDispatch = useDispatch(); + + /* 本実装の際に消す想定です。 + POデモ時に階層情報を表示するための実装です。 */ + const getUserTier = () => { + const jwt = loadAccessToken(); // トークンを取得 + const token = jwt && decodeToken(jwt); // トークンをデコード + + if (token && token.tier) { + return token.tier.toString(); // ユーザーの階層情報を取得 + } + + return "error!"; // 階層情報が見つからない場合はerror!を返す + }; + + /* 本実装の際に消す想定です。 + ログインしているアカウントの階層を確認するために実装 */ + const userTier = getUserTier(); + // 第1~3階層にボタンを表示する + const isVisible = isApproveTier([TIERS.TIER1, TIERS.TIER2, TIERS.TIER3]); + + // HTML + return ( +
+
+ +
+
    +
  • + {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */} + {isVisible && ( + + + Add Account + + )} +
  • +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+ ); +}; + +export default PartnerPage;