yasshi2525/RushHour

View on GitHub
client/src/components/Maintenance.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { useMemo, Fragment, useContext } from "react";
import AdminPageContext from "common/admin";
import LogOut from "./LogOut";

const AdminPage = () => {
  return (
    <Fragment>
      <LogOut />
      [TODO]管理者操作
    </Fragment>
  );
};

const TopPage = () => (
  <div>メンテナンス中です。時間をあけて再アクセスしてください。</div>
);

export default () => {
  const isAdminPage = useContext(AdminPageContext);

  return useMemo(() => (isAdminPage ? <AdminPage /> : <TopPage />), [
    isAdminPage
  ]);
};