aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/views/user/index.tsx
blob: 7913b7883303e964038080e39146d5dcf6149f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import { useParams } from "react-router-dom";

import TimelinePageTemplate from "../timeline-common/TimelinePageTemplate";
import UserCard from "./UserCard";

import { UiLogicError } from "@/common";

import "./index.css";

const UserPage: React.FC = () => {
  const { username } = useParams();

  if (username == null) {
    throw new UiLogicError("No route param 'username'.");
  }

  const [reloadKey, setReloadKey] = React.useState<number>(0);

  let dialogElement: React.ReactElement | undefined;

  return (
    <>
      <TimelinePageTemplate
        timelineName={`@${username}`}
        notFoundI18nKey="timeline.userNotExist"
        reloadKey={reloadKey}
        onReload={() => setReloadKey(reloadKey + 1)}
        CardComponent={UserCard}
      />
      {dialogElement}
    </>
  );
};

export default UserPage;