|
|
@ -1,7 +1,7 @@
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
import { useNavigate } from "react-router-dom";
|
|
|
|
import { useGlobalStore, useLocationStore, useMemoStore, useUserStore } from "../store/module";
|
|
|
|
import { useGlobalStore, useLocationStore, useMemoStore, useUserStore } from "../store/module";
|
|
|
|
import { DEFAULT_MEMO_LIMIT } from "../helpers/consts";
|
|
|
|
import { DEFAULT_MEMO_LIMIT } from "../helpers/consts";
|
|
|
|
import useLoading from "../hooks/useLoading";
|
|
|
|
import useLoading from "../hooks/useLoading";
|
|
|
@ -19,6 +19,7 @@ interface State {
|
|
|
|
|
|
|
|
|
|
|
|
const Explore = () => {
|
|
|
|
const Explore = () => {
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
const { t, i18n } = useTranslation();
|
|
|
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
const globalStore = useGlobalStore();
|
|
|
|
const globalStore = useGlobalStore();
|
|
|
|
const locationStore = useLocationStore();
|
|
|
|
const locationStore = useLocationStore();
|
|
|
|
const userStore = useUserStore();
|
|
|
|
const userStore = useUserStore();
|
|
|
@ -72,11 +73,11 @@ const Explore = () => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
: state.memos;
|
|
|
|
: state.memos;
|
|
|
|
|
|
|
|
|
|
|
|
const memoSort = (mi: Memo, mj: Memo) => {
|
|
|
|
const sortedMemos = shownMemos
|
|
|
|
return mj.displayTs - mi.displayTs;
|
|
|
|
.filter((m) => m.rowStatus === "NORMAL")
|
|
|
|
};
|
|
|
|
.sort((mi: Memo, mj: Memo) => {
|
|
|
|
shownMemos.sort(memoSort);
|
|
|
|
return mj.displayTs - mi.displayTs;
|
|
|
|
const sortedMemos = shownMemos.filter((m) => m.rowStatus === "NORMAL");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const handleFetchMoreClick = async () => {
|
|
|
|
const handleFetchMoreClick = async () => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -109,27 +110,31 @@ const Explore = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleTitleClick = () => {
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
|
|
|
|
navigate("/");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
navigate("/auth");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<section className="page-wrapper explore">
|
|
|
|
<section className="page-wrapper explore">
|
|
|
|
<div className="page-container">
|
|
|
|
<div className="page-container">
|
|
|
|
<div className="page-header">
|
|
|
|
<div className="page-header">
|
|
|
|
<div className="title-container">
|
|
|
|
<div className="title-container cursor-pointer hover:opacity-80" onClick={handleTitleClick}>
|
|
|
|
<img className="logo-img" src={customizedProfile.logoUrl} alt="" />
|
|
|
|
<img className="logo-img" src={customizedProfile.logoUrl} alt="" />
|
|
|
|
<span className="title-text">{customizedProfile.name}</span>
|
|
|
|
<span className="title-text">{customizedProfile.name}</span>
|
|
|
|
<a className="dark:text-white ml-1 mt-1" href="/explore/rss.xml" target="_blank" rel="noreferrer">
|
|
|
|
|
|
|
|
<Icon.Rss className="w-6 h-auto opacity-40 hover:opacity-60" />
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="action-button-container">
|
|
|
|
<div className="flex flex-row justify-end items-center">
|
|
|
|
{!loadingState.isLoading && user ? (
|
|
|
|
<a
|
|
|
|
<Link to="/" className="link-btn btn-normal">
|
|
|
|
className="flex flex-row justify-center items-center h-12 w-12 border rounded-full hover:opacity-80 hover:shadow dark:text-white "
|
|
|
|
<span>🏠</span> {t("common.back-to-home")}
|
|
|
|
href="/explore/rss.xml"
|
|
|
|
</Link>
|
|
|
|
target="_blank"
|
|
|
|
) : (
|
|
|
|
rel="noreferrer"
|
|
|
|
<Link to="/auth" className="link-btn btn-normal">
|
|
|
|
>
|
|
|
|
<span>👉</span> {t("common.sign-in")}
|
|
|
|
<Icon.Rss className="w-7 h-auto opacity-60" />
|
|
|
|
</Link>
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{!loadingState.isLoading && (
|
|
|
|
{!loadingState.isLoading && (
|
|
|
|