diff --git a/public/og.jpg b/public/og.jpg new file mode 100644 index 000000000..3e680f5ad Binary files /dev/null and b/public/og.jpg differ diff --git a/src/api/operations.ts b/src/api/operations.ts index f28695905..30a2d4bfa 100644 --- a/src/api/operations.ts +++ b/src/api/operations.ts @@ -417,13 +417,7 @@ export const transferPointKc = (from: string, to: string, amount: string, memo: memo }); - return keychain.customJson( - from, - "ecency_point_transfer", - "Active", - json, - "Point Transfer" - ); + return keychain.customJson(from, "ecency_point_transfer", "Active", json, "Point Transfer"); }; export const transferToSavings = ( @@ -501,7 +495,7 @@ export const limitOrderCreate = ( ? formatNumber(amount_to_sell, 3) : formatNumber(mini_to_receive, 3) } ${orderType === BuySellHiveTransactionType.Buy ? "HBD" : "HIVE"}`, - mini_to_receive: `${ + min_to_receive: `${ orderType === BuySellHiveTransactionType.Buy ? formatNumber(mini_to_receive, 3) : formatNumber(amount_to_sell, 3) diff --git a/src/api/queries/get-posts-ranked-query.ts b/src/api/queries/get-posts-ranked-query.ts index 7ff5809c2..8b370c0ed 100644 --- a/src/api/queries/get-posts-ranked-query.ts +++ b/src/api/queries/get-posts-ranked-query.ts @@ -29,7 +29,14 @@ export const getPostsRankedQuery = ( if (response) { const data = await Promise.all(response.map((item) => resolvePost(item, observer))); - return data.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime()); + const sorted = + sort === "hot" + ? data + : data.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime()); + return [ + sorted.find((s) => s.stats.is_pinned), + ...sorted.filter((s) => !s.stats.is_pinned) + ].filter((s) => !!s) as Entry[]; } return []; diff --git a/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx b/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx index f7a73f8f7..d33abd1dc 100644 --- a/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx +++ b/src/app/(dynamicPages)/community/[community]/[tag]/page.tsx @@ -1,5 +1,5 @@ import { getCommunityCache } from "@/core/caches"; -import { notFound, redirect } from "next/navigation"; +import { notFound } from "next/navigation"; import { prefetchGetPostsFeedQuery } from "@/api/queries"; import { EntryListContent, LinearProgress } from "@/features/shared"; import { CommunityContentSearch } from "@/app/(dynamicPages)/community/[community]/_components/community-content-search"; @@ -44,6 +44,7 @@ export default async function CommunityPostsPage({ params: { community, tag } }: {/*{(!query || query?.length === 0) && (*/} ((acc, page) => [...acc, ...(page as Entry[])], [])} diff --git a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/index.tsx b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/index.tsx index 30658dbcf..d3785395c 100644 --- a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/index.tsx +++ b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/index.tsx @@ -25,7 +25,7 @@ export function ProfileReferrals({ account }: Props) { ); return ( -
+
{isLoading && }
diff --git a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referral-header.tsx b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referral-header.tsx index 7feace89f..5f970a4e0 100644 --- a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referral-header.tsx +++ b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referral-header.tsx @@ -6,6 +6,7 @@ import { Tsx } from "@/features/i18n/helper"; import { success } from "@/features/shared"; import { Account } from "@/entities"; import { getReferralsStatsQuery } from "@/api/queries"; +import { Badge } from "@ui/badge"; interface Props { account: Account; @@ -34,29 +35,30 @@ export function ProfileReferralHeader({ account }: Props) { }, []); return ( -
-
{i18next.t("referral.page-title")}
+
+
+
{i18next.t("referral.page-title")}
+ +
-
-
-
{earnedPoints}
-
{i18next.t("referral.earned-reward")}
-
-
-
{unearnedPoints}
-
{i18next.t("referral.pending-reward")}
+
+
+
{i18next.t("referral.earned-reward")}
+ {earnedPoints}
-
- +
+
{i18next.t("referral.pending-reward")}
+ {unearnedPoints}
-
+
); diff --git a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referrals-table.tsx b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referrals-table.tsx index 84ee7184f..44c18e9d4 100644 --- a/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referrals-table.tsx +++ b/src/app/(dynamicPages)/profile/[username]/_components/profile-referrals/profile-referrals-table.tsx @@ -43,10 +43,10 @@ export function ProfileReferralsTable({ account, pageSize, page }: Props) { - + - - + diff --git a/src/app/communities/_components/communities-list.tsx b/src/app/communities/_components/communities-list.tsx index d3d9f8f3f..98afac6fb 100644 --- a/src/app/communities/_components/communities-list.tsx +++ b/src/app/communities/_components/communities-list.tsx @@ -5,6 +5,7 @@ import { CommunitiesListSearch } from "@/app/communities/_components/communities import { CommunitiesListSortSelector } from "@/app/communities/_components/communities-list-sort-selector"; import { CommunityListItemAnimatedLayout } from "@/app/communities/_components/community-list-item-animated-layout"; import { SafeAnimatePresence } from "@/features/framer-motion"; +import { getCommunityCache } from "@/core/caches"; interface Props { sort: string; @@ -12,7 +13,14 @@ interface Props { } export async function CommunitiesList({ sort, query }: Props) { - const list = getCommunitiesQuery(sort, query).getData(); + let list = getCommunitiesQuery(sort, query).getData(); + const ecencyCommunity = + list?.find((x) => x.name === "hive-125125") ?? + (await getCommunityCache("hive-125125").prefetch()); + + if (ecencyCommunity) { + list = [ecencyCommunity, ...(list?.filter((x) => x.name !== "hive-125125") ?? [])]; + } return ( <> diff --git a/src/app/proposals/_page.tsx b/src/app/proposals/_page.tsx index 7a048f053..6990c5e80 100644 --- a/src/app/proposals/_page.tsx +++ b/src/app/proposals/_page.tsx @@ -1,5 +1,5 @@ "use client"; -import React, { Fragment, useMemo, useState } from "react"; +import React, { Fragment, useMemo, useRef, useState } from "react"; import numeral from "numeral"; import defaults from "@/defaults.json"; import { setProxyBase } from "@ecency/render-helper"; @@ -11,8 +11,9 @@ import { ProposalListItem } from "@/app/proposals/_components"; import { getAccountFullQuery, getProposalsQuery } from "@/api/queries"; import { parseAsset } from "@/utils"; import { Proposal } from "@/entities"; -import { Button } from "@ui/button"; import { AnimatePresence, motion } from "framer-motion"; +import { useInViewport } from "react-in-viewport"; +import { useDebounce } from "react-use"; setProxyBase(defaults.imageServer); @@ -24,6 +25,8 @@ enum Filter { } export function ProposalsPage() { + const infiniteLoadingAnchorRef = useRef(null); + const { data: proposals, isLoading } = getProposalsQuery().useClientQuery(); const { data: fund } = getAccountFullQuery("hive.fund").useClientQuery(); const [page, setPage] = useState(1); @@ -94,6 +97,18 @@ export function ProposalsPage() { }; }, [dailyBudget, proposals]); + const { inViewport } = useInViewport(infiniteLoadingAnchorRef); + + useDebounce( + () => { + if (inViewport) { + setPage((page) => page + 1); + } + }, + 1000, + [inViewport] + ); + return ( <> @@ -172,13 +187,8 @@ export function ProposalsPage() { ))} - - )} - {page * 5 < (filteredProposals?.length ?? 0) && ( -
- + +
)}
diff --git a/src/features/shared/comment/index.tsx b/src/features/shared/comment/index.tsx index cb13d587e..ce290bf95 100644 --- a/src/features/shared/comment/index.tsx +++ b/src/features/shared/comment/index.tsx @@ -6,7 +6,7 @@ import "./_index.scss"; import { Spinner } from "@ui/spinner"; import { Button } from "@ui/button"; import defaults from "@/defaults.json"; -import { LoginRequired } from "@/features/shared"; +import { AvailableCredits, LoginRequired } from "@/features/shared"; import { CommentPreview } from "@/features/shared/comment/comment-preview"; import { useGlobalStore } from "@/core/global-store"; import i18next from "i18next"; @@ -15,9 +15,10 @@ import { Entry } from "@/entities"; import { useDebounce, useMount } from "react-use"; import useUnmount from "react-use/lib/useUnmount"; import { detectEvent, EditorToolbar, toolbarEventListener } from "@/features/shared/editor-toolbar"; -import { AvailableCredits } from "@/features/shared"; import { TextareaAutocomplete } from "@/features/shared/textarea-autocomplete"; import usePrevious from "react-use/lib/usePrevious"; +import useLocalStorage from "react-use/lib/useLocalStorage"; +import { PREFIX } from "@/utils/local-storage"; setProxyBase(defaults.imageServer); @@ -51,7 +52,7 @@ export function Comment({ const commentBodyRef = useRef(null); const activeUser = useGlobalStore((s) => s.activeUser); - const [text, setText] = useState(""); + const [text, setText] = useLocalStorage(PREFIX + "_c_t", ""); const [inputHeight, setInputHeight] = useState(0); const [preview, setPreview] = useState(""); const [showEmoji, setShowEmoji] = useState(false); @@ -60,11 +61,11 @@ export function Comment({ const previousDefText = usePrevious(defText); const previousIsCommented = usePrevious(isCommented); - const rows = useMemo(() => text.split(/\r\n|\r|\n|
/).length, [text]); + const rows = useMemo(() => text!.split(/\r\n|\r|\n|
/).length, [text]); useDebounce( () => { - setPreview(text); + setPreview(text!); }, 50, [text] @@ -104,7 +105,7 @@ export function Comment({ }, []); const submit = useCallback(async () => { - await onSubmit(text); + await onSubmit(text!); setText(""); }, [text, onSubmit]); @@ -178,7 +179,7 @@ export function Comment({
20 ? "expanded" : ""}`} + className={`the-editor accepts-emoji ${text!.length > 20 ? "expanded" : ""}`} as="textarea" placeholder={i18next.t("comment.body-placeholder")} containerStyle={{ height: !text ? "80px" : inputHeight }} diff --git a/src/features/shared/entry-list-content/index.tsx b/src/features/shared/entry-list-content/index.tsx index d229834ab..ca8279223 100644 --- a/src/features/shared/entry-list-content/index.tsx +++ b/src/features/shared/entry-list-content/index.tsx @@ -1,6 +1,6 @@ import React from "react"; import "./_index.scss"; -import { Account, Entry } from "@/entities"; +import { Account, Community, Entry } from "@/entities"; import { EntryListItem } from "@/features/shared"; import { getPromotedEntriesQuery } from "@/api/queries"; import { EntryListContentNoData } from "@/features/shared/entry-list-content/entry-list-content-no-data"; @@ -13,6 +13,7 @@ interface Props { username: string; showEmptyPlaceholder?: boolean; account?: Account; + community?: Community; } export function EntryListContent({ @@ -22,7 +23,8 @@ export function EntryListContent({ loading, username, showEmptyPlaceholder = true, - account + account, + community }: Props) { let dataToRender = [...entries]; let promotedEntries: Entry[] = []; @@ -50,6 +52,7 @@ export function EntryListContent({ entry={p} promoted={true} order={4} + community={community} /> ); } @@ -64,6 +67,7 @@ export function EntryListContent({ key={`${e.author}-${e.permlink}`} entry={e} order={i} + community={community} /> ); } else { @@ -73,6 +77,7 @@ export function EntryListContent({ key={`${e.author}-${e.permlink}`} entry={e} order={i} + community={community} /> ); } diff --git a/src/features/shared/entry-list-item/index.tsx b/src/features/shared/entry-list-item/index.tsx index e4fa0b6ba..af23f7be8 100644 --- a/src/features/shared/entry-list-item/index.tsx +++ b/src/features/shared/entry-list-item/index.tsx @@ -4,7 +4,7 @@ import "./_index.scss"; import defaults from "@/defaults.json"; import { Account, Community, Entry, FullAccount } from "@/entities"; import { dateToFormatted, dateToRelative } from "@/utils"; -import { commentSvg, pinSvg, repeatSvg } from "@ui/svg"; +import { pinSvg, repeatSvg } from "@ui/svg"; import { EntryLink } from "../entry-link"; import { EntryMenu, @@ -51,10 +51,10 @@ export function EntryListItemComponent({ }: Props) { const pageAccount = account as FullAccount; - const pinned = pageAccount?.profile?.pinned; - const isCrossPost = !!entryProp.original_entry; const entry = entryProp.original_entry || entryProp; + const pinned = entry?.stats?.is_pinned ?? pageAccount?.profile?.pinned; + const dateRelative = dateToRelative(entry.created); const dateFormatted = dateToFormatted(entry.created); const reBlogged = diff --git a/src/features/shared/navbar/sidebar/navbar-side-main-menu.tsx b/src/features/shared/navbar/sidebar/navbar-side-main-menu.tsx index 5f8c96644..920f9f611 100644 --- a/src/features/shared/navbar/sidebar/navbar-side-main-menu.tsx +++ b/src/features/shared/navbar/sidebar/navbar-side-main-menu.tsx @@ -139,13 +139,13 @@ export function NavbarSideMainMenu({ onHide }: Props) {
} /> } />
{i18next.t("referral.created")}{i18next.t("referral.created")} {i18next.t("referral.list-referral")}{i18next.t("referral.rewarded")} + {i18next.t("referral.rewarded")}