From e3e927eac2528281f193d3a0a61cbd35e4d8b724 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 15 Apr 2021 17:57:50 +0800 Subject: ... --- .../src/app/views/home-v2/TimelineListView.tsx | 85 ++++++++++++++++++++++ FrontEnd/src/app/views/home-v2/home-v2.sass | 18 +++++ FrontEnd/src/app/views/home-v2/index.tsx | 55 ++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 FrontEnd/src/app/views/home-v2/TimelineListView.tsx create mode 100644 FrontEnd/src/app/views/home-v2/home-v2.sass create mode 100644 FrontEnd/src/app/views/home-v2/index.tsx (limited to 'FrontEnd/src/app/views/home-v2') diff --git a/FrontEnd/src/app/views/home-v2/TimelineListView.tsx b/FrontEnd/src/app/views/home-v2/TimelineListView.tsx new file mode 100644 index 00000000..1ba9f765 --- /dev/null +++ b/FrontEnd/src/app/views/home-v2/TimelineListView.tsx @@ -0,0 +1,85 @@ +import React from "react"; + +import { convertI18nText, I18nText } from "@/common"; + +import { HttpTimelineInfo } from "@/http/timeline"; +import { useTranslation } from "react-i18next"; + +interface TimelineListItemProps { + timeline: HttpTimelineInfo; +} + +const TimelineListItem: React.FC = ({ timeline }) => { + return ( +
+ + + +
{timeline.title}
+
+ ); +}; + +const TimelineListLoading: React.FC = () => { + return ( +
+
+ + + +
+
+ + + +
+
+ ); +}; + +interface TimelineListViewProps { + headerText?: I18nText; + timelines?: HttpTimelineInfo[]; +} + +const TimelineListView: React.FC = ({ + headerText, + timelines, +}) => { + const { t } = useTranslation(); + + return ( +
+
+ + + +

{convertI18nText(headerText, t)}

+
+ {timelines != null ? ( + timelines.map((t) => ) + ) : ( + + )} +
+ ); +}; + +export default TimelineListView; diff --git a/FrontEnd/src/app/views/home-v2/home-v2.sass b/FrontEnd/src/app/views/home-v2/home-v2.sass new file mode 100644 index 00000000..a3218f08 --- /dev/null +++ b/FrontEnd/src/app/views/home-v2/home-v2.sass @@ -0,0 +1,18 @@ +.home-v2-timeline-list-item + display: flex + align-items: center + +.home-v2-timeline-list-item-line + width: 80px + flex-shrink: 0 + +@keyframes home-v2-timeline-list-loading-head-animation + from + transform: translate(0,-30px) + opacity: 1 + + to + opacity: 0 + +.home-v2-timeline-list-loading-head + animation: 1s infinite home-v2-timeline-list-loading-head-animation diff --git a/FrontEnd/src/app/views/home-v2/index.tsx b/FrontEnd/src/app/views/home-v2/index.tsx new file mode 100644 index 00000000..d0013f1b --- /dev/null +++ b/FrontEnd/src/app/views/home-v2/index.tsx @@ -0,0 +1,55 @@ +import React from "react"; +import { useHistory } from "react-router"; +import { useTranslation } from "react-i18next"; +import { Container, Button } from "react-bootstrap"; + +import { useUser } from "@/services/user"; +import SearchInput from "../common/SearchInput"; + +import TimelineListView from "./TimelineListView"; +import TimelineCreateDialog from "../home/TimelineCreateDialog"; + +const HomeV2: React.FC = () => { + const history = useHistory(); + + const { t } = useTranslation(); + + const user = useUser(); + + const [navText, setNavText] = React.useState(""); + + const [dialog, setDialog] = React.useState<"create" | null>(null); + + return ( + <> + + { + history.push(`search?q=${navText}`); + }} + additionalButton={ + user != null && ( + + ) + } + /> + + + {dialog === "create" && ( + setDialog(null)} /> + )} + + ); +}; + +export default HomeV2; -- cgit v1.2.3