From 7b81a6e09dc884d6e9cdc1ff5ce7ec6520416cba Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Tue, 29 Nov 2022 07:27:56 +0000 Subject: [PATCH] move spaces --- packages/app/src/pages/home/[type].jsx | 26 ++-- packages/app/src/pages/home/[type].mobile.jsx | 30 ++--- .../home/components/livestreams/index.jsx | 123 ------------------ .../home/components/livestreams/index.less | 119 ----------------- .../pages/home/components/trendings/index.jsx | 14 ++ .../home/components/trendings/index.less | 1 + packages/app/src/pages/home/index.jsx | 2 +- 7 files changed, 42 insertions(+), 273 deletions(-) delete mode 100644 packages/app/src/pages/home/components/livestreams/index.jsx delete mode 100644 packages/app/src/pages/home/components/livestreams/index.less create mode 100644 packages/app/src/pages/home/components/trendings/index.jsx create mode 100644 packages/app/src/pages/home/components/trendings/index.less diff --git a/packages/app/src/pages/home/[type].jsx b/packages/app/src/pages/home/[type].jsx index e8edf9c4..702cc4a8 100755 --- a/packages/app/src/pages/home/[type].jsx +++ b/packages/app/src/pages/home/[type].jsx @@ -6,10 +6,10 @@ import { Icons, createIconRender } from "components/Icons" import { HashtagTrendings, FeaturedEventsAnnouncements, ConnectedFriends } from "components" -import FeedBrowser from "./components/feed" -import ExploreBrowser from "./components/explore" -import LivestreamsBrowser from "./components/livestreams" -import SavedPostsBrowser from "./components/savedPosts" +import FeedTab from "./components/feed" +import ExploreTab from "./components/explore" +import TrendingsTab from "./components/trendings" +import SavedPostsTab from "./components/savedPosts" import "./index.less" @@ -17,23 +17,23 @@ const Tabs = { "feed": { title: "Feed", icon: "Rss", - component: FeedBrowser + component: FeedTab + }, + "trendings": { + title: "Trendings", + icon: "TrendingUp", + component: TrendingsTab }, "explore": { title: "Explore", icon: "Search", - component: ExploreBrowser + component: ExploreTab }, "savedPosts": { title: "Saved posts", icon: "Bookmark", - component: SavedPostsBrowser - }, - "livestreams": { - title: "Livestreams", - icon: "Tv", - component: LivestreamsBrowser - }, + component: SavedPostsTab + } } export default class Dashboard extends React.Component { diff --git a/packages/app/src/pages/home/[type].mobile.jsx b/packages/app/src/pages/home/[type].mobile.jsx index 406b0398..9edfc8c0 100644 --- a/packages/app/src/pages/home/[type].mobile.jsx +++ b/packages/app/src/pages/home/[type].mobile.jsx @@ -2,14 +2,10 @@ import React from "react" import * as antd from "antd" import classnames from "classnames" -import { Icons, createIconRender } from "components/Icons" - -import { HashtagTrendings, FeaturedEventsAnnouncements, ConnectedFriends } from "components" - -import FeedBrowser from "./components/feed" -import ExploreBrowser from "./components/explore" -import LivestreamsBrowser from "./components/livestreams" -import SavedPostsBrowser from "./components/savedPosts" +import FeedTab from "./components/feed" +import ExploreTab from "./components/explore" +import TrendingsTab from "./components/trendings" +import SavedPostsTab from "./components/savedPosts" import "./index.less" @@ -17,23 +13,23 @@ const Tabs = { "feed": { title: "Feed", icon: "Rss", - component: FeedBrowser + component: FeedTab + }, + "trendings": { + title: "Trendings", + icon: "TrendingUp", + component: TrendingsTab }, "explore": { title: "Explore", icon: "Search", - component: ExploreBrowser + component: ExploreTab }, "savedPosts": { title: "Saved posts", icon: "Bookmark", - component: SavedPostsBrowser - }, - "livestreams": { - title: "Livestreams", - icon: "Tv", - component: LivestreamsBrowser - }, + component: SavedPostsTab + } } export default class Dashboard extends React.Component { diff --git a/packages/app/src/pages/home/components/livestreams/index.jsx b/packages/app/src/pages/home/components/livestreams/index.jsx deleted file mode 100644 index e6177e68..00000000 --- a/packages/app/src/pages/home/components/livestreams/index.jsx +++ /dev/null @@ -1,123 +0,0 @@ -import React from "react" -import * as antd from "antd" - -import { UserPreview } from "components" -import { Icons } from "components/Icons" - -import Livestream from "../../../../models/livestream" - -import "./index.less" - -const LivestreamItem = (props) => { - const { livestream = {} } = props - - const handleOnClick = async () => { - if (typeof props.onClick !== "function") { - console.warn("LivestreamItem: onClick is not a function") - return - } - - return await props.onClick(livestream) - } - - return
-
- -
-
- - -
-

{livestream.info?.title}

-
-
-

{livestream.info?.description ?? "No description"}

-
-
- {livestream.info?.category?.label ?? "No category"} -
-
-
-} - -export default (props) => { - const [loading, setLoading] = React.useState(true) - const [list, setList] = React.useState([]) - - const loadStreamings = async () => { - setLoading(true) - - const livestreams = await Livestream.getLivestreams().catch((err) => { - console.error(err) - app.message.error("Failed to load livestreams") - return false - }) - - console.log("Livestreams", livestreams) - - setLoading(false) - - if (livestreams) { - if (!Array.isArray(livestreams)) { - console.error("Livestreams is not an array") - return false - } - - setList(livestreams) - } - } - - const onClickItem = (livestream) => { - app.setLocation(`/live/${livestream.username}`) - } - - const onClickControlPanel = () => { - app.setLocation("/live_control") - } - - const renderList = () => { - if (loading) { - return - } - - if (list.length === 0) { - return -

- No livestreams found -

-
- } - - return list.map((livestream) => { - return - }) - } - - React.useEffect(() => { - loadStreamings() - }, []) - - return
-
-
-

- - Livestreams -

-
- -
- } - onClick={onClickControlPanel} - > - Control Panel - -
-
- -
- {renderList()} -
-
-} diff --git a/packages/app/src/pages/home/components/livestreams/index.less b/packages/app/src/pages/home/components/livestreams/index.less deleted file mode 100644 index 6c27f523..00000000 --- a/packages/app/src/pages/home/components/livestreams/index.less +++ /dev/null @@ -1,119 +0,0 @@ -@item_border_radius: 10px; - -.livestreamsBrowser { - display: flex; - flex-direction: column; - - width: 100%; - - .header { - display: inline-flex; - flex-direction: row; - - align-items: center; - justify-content: space-between; - - width: 100%; - - .panel { - display: inline-flex; - flex-direction: row; - - align-items: center; - } - - .title { - svg { - font-size: 2.5rem; - } - } - - font-size: 2rem; - } - - .livestream_list { - display: flex; - flex-direction: column; - padding: 0 50px; - - .livestream_item { - display: flex; - flex-direction: row; - - align-items: center; - - background-color: var(--background-color-primary2); - - border: 1px solid var(--border-color); - - padding: 10px; - margin-bottom: 20px; - - border-radius: @item_border_radius; - - cursor: pointer; - transition: all 0.2s ease-in-out; - - &:hover { - background-color: var(--background-color-accent); - } - - .livestream_thumbnail { - width: 8vw; - height: 100%; - - img { - width: 100%; - height: 100%; - border-radius: @item_border_radius; - } - } - - .livestream_info { - position: relative; - - width: 100%; - - margin-left: 20px; - font-size: 1rem; - - padding: 10px 0; - - color: var(--text-color); - - .userPreview { - font-size: 1.5rem; - } - - h1, - h2 { - margin: 0; - height: fit-content; - color: var(--text-color); - } - - .livestream_title { - margin-top: 10px; - font-size: 1.5rem; - height: fit-content; - font-family: "Space Grotesk", sans-serif; - } - - .livestream_description { - font-size: 0.6rem; - font-weight: 400; - height: fit-content; - } - - .livestream_category { - position: absolute; - - top: 0; - right: 0; - - padding: 10px; - } - } - } - } -} \ No newline at end of file diff --git a/packages/app/src/pages/home/components/trendings/index.jsx b/packages/app/src/pages/home/components/trendings/index.jsx new file mode 100644 index 00000000..ddc03329 --- /dev/null +++ b/packages/app/src/pages/home/components/trendings/index.jsx @@ -0,0 +1,14 @@ +import React from "react" +import { Result } from "antd" + +import "./index.less" + +export default (props) => { + return
+ +
+} \ No newline at end of file diff --git a/packages/app/src/pages/home/components/trendings/index.less b/packages/app/src/pages/home/components/trendings/index.less new file mode 100644 index 00000000..db49f864 --- /dev/null +++ b/packages/app/src/pages/home/components/trendings/index.less @@ -0,0 +1 @@ +.trendingsBrowser {} \ No newline at end of file diff --git a/packages/app/src/pages/home/index.jsx b/packages/app/src/pages/home/index.jsx index 138fffe9..0c9a5808 100644 --- a/packages/app/src/pages/home/index.jsx +++ b/packages/app/src/pages/home/index.jsx @@ -1,7 +1,7 @@ import React from "react" export default () => { - app.setLocation("home/feed") + app.setLocation("/home/feed") return <> } \ No newline at end of file