Skip to content

Commit

Permalink
deprecate curation
Browse files Browse the repository at this point in the history
  • Loading branch information
artlu99 committed Aug 31, 2024
1 parent 8845554 commit 631cf48
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 147 deletions.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/api/curation.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export interface CurationPutRequest {
action: ActionEnumType;
}

export const getVotes = (): Promise<VotesResponse> =>
httpApi.get<VotesResponse>('getCuration').then(({ data }) => data);
export const getVotesDeprecated = (): Promise<VotesResponse> =>
httpApi.get<VotesResponse>('getCurationDeprecated').then(({ data }) => data);

export const getCuration = (curationRequestPayload: CurationRequest): Promise<CurationResponse> =>
httpApi.post<CurationResponse>('getCuration', { ...curationRequestPayload }).then(({ data }) => data);
httpApi.post<CurationResponse>('getCurationDeprecated', { ...curationRequestPayload }).then(({ data }) => data);

export const putCuration = (curationPutRequestPayload: CurationPutRequest): Promise<{ message: string }> =>
httpApi.put<{ message: string }>('getCuration', { ...curationPutRequestPayload }).then(({ data }) => data);
httpApi.put<{ message: string }>('getCurationDeprecated', { ...curationPutRequestPayload }).then(({ data }) => data);
36 changes: 18 additions & 18 deletions src/api/mocks/mockornot.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// comment out for prod
// import './allChannels.api.mock';
// import './botOrNot.api.mock';
// import './castByHash.api.mock';
// import './channelById.api.mock';
// import './cronFeed.api.mock';
// import './curation.api.mock';
// import './decent-bookmarks.api.mock';
// import './fcan.api.mock';
// import './followingByFid.api.mock';
// import './followingFeed.api.mock';
// import './forYouFeed.api.mock';
// import './hubReactionsByFid.api.mock';
// import './metadata.api.mock';
// import './neynarReactionsByFid.api.mock';
// import './powerbadge.api.mock';
// import './reactionOnHash.api.mock';
// import './reactionsByHash.api.mock';
// import './userFollowingChannels.api.mock';
import './allChannels.api.mock';
import './botOrNot.api.mock';
import './castByHash.api.mock';
import './channelById.api.mock';
import './cronFeed.api.mock';
import './curation.api.mock';
import './decent-bookmarks.api.mock';
import './fcan.api.mock';
import './followingByFid.api.mock';
import './followingFeed.api.mock';
import './forYouFeed.api.mock';
import './hubReactionsByFid.api.mock';
import './metadata.api.mock';
import './neynarReactionsByFid.api.mock';
import './powerbadge.api.mock';
import './reactionOnHash.api.mock';
import './reactionsByHash.api.mock';
import './userFollowingChannels.api.mock';
4 changes: 0 additions & 4 deletions src/components/apps/cast/Cast.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BotOrNotResult } from '@app/api/botOrNot.api';
import { Curation } from '@app/api/curation.api';
import { EmbedObject } from '@app/api/feed-types';
import { AltClientLinks } from '@app/components/apps/cast/AltClientLinks';
import { Embed } from '@app/components/apps/cast/Embed';
Expand Down Expand Up @@ -40,7 +39,6 @@ export interface CastProps {
recastooors: number[];
likooors: number[];
tags: IHashTag[];
curation?: { upvotes: Curation[]; downvotes: Curation[] };
className?: string;
url?: string;
}
Expand All @@ -67,7 +65,6 @@ export const Cast: React.FC<CastProps> = ({
likes,
likooors,
tags,
curation,
className,
url,
}) => {
Expand Down Expand Up @@ -161,7 +158,6 @@ export const Cast: React.FC<CastProps> = ({
replies={replies}
recasts={recasts}
likes={likes}
curation={curation}
allLikooors={allLikooors}
setAllLikooors={setAllLikooors}
allRecastooors={allRecastooors}
Expand Down
64 changes: 1 addition & 63 deletions src/components/apps/cast/Reactions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Curation, putCuration } from '@app/api/curation.api';
import { HubReactionType, HubReactionsResponse, HubReactionsStreamItem } from '@app/api/hubble-http-types';
import { setReactionOnHash } from '@app/api/reactionOnHash.api';
import { getFidWithFallback } from '@app/auth/fids';
Expand All @@ -11,14 +10,7 @@ import { hubReactionsByFidQuery } from '@app/queries/queries';
import { BASE_COLORS } from '@app/styles/themes/constants';
import { useNeynarContext } from '@neynar/react';
import { useQuery } from '@tanstack/react-query';
import {
BarChartBigIcon,
LucideHeart,
LucideMessageSquare,
LucideRepeat2,
LucideThumbsDown,
LucideThumbsUp,
} from 'lucide-react';
import { BarChartBigIcon, LucideHeart, LucideMessageSquare, LucideRepeat2 } from 'lucide-react';
import { Dispatch, SetStateAction, useMemo, useState } from 'react';
import * as S from './Cast.styles';

Expand All @@ -42,24 +34,20 @@ const isStateAdded = (stream: HubReactionsStreamItem[], hash: string): boolean =

export interface ReactionsProps {
castHash: string;
castFid: number;
replies: number;
recasts: number;
likes: number;
allLikooors: number[];
setAllLikooors: Dispatch<SetStateAction<number[]>>;
allRecastooors: number[];
setAllRecastooors: Dispatch<SetStateAction<number[]>>;
curation?: { upvotes: Curation[]; downvotes: Curation[] };
}

export const Reactions: React.FC<ReactionsProps> = ({
castHash,
castFid,
replies,
recasts,
likes,
curation,
allLikooors,
setAllLikooors,
allRecastooors,
Expand All @@ -68,8 +56,6 @@ export const Reactions: React.FC<ReactionsProps> = ({
const [isAnalyticsOpen, setAnalyticsOpen] = useState(false);
const [optimisticLikes, setOptimisticLikes] = useState(0);
const [optimisticRecasts, setOptimisticRecasts] = useState(0);
const [optimisticUpvotes, setOptimisticUpvotes] = useState(0);
const [optimisticDownvotes, setOptimisticDownvotes] = useState(0);

const zenModeState = useAppSelector((state) => state.zenMode);
const showReactions = zenModeState.showReactions;
Expand Down Expand Up @@ -122,32 +108,10 @@ export const Reactions: React.FC<ReactionsProps> = ({
}
};

const handleUpvote = async (castHash: string, castFid: number) => {
if (user?.fid) {
setOptimisticUpvotes(optimisticUpvotes + 1);
await putCuration({ castHash, castFid, actionFid: user.fid, action: 'upvote' });
} else {
console.log('must be logged in to vote!');
}
};

const handleDownvote = async (castHash: string, castFid: number) => {
if (user?.fid) {
setOptimisticDownvotes(optimisticDownvotes + 1);
await putCuration({ castHash, castFid, actionFid: user.fid, action: 'downvote' });
} else {
console.log('must be logged in to vote!');
}
};

const amLikooor =
isStateAdded(memodLikes ?? [], castHash) || optimisticLikes || allLikooors.includes(user?.fid ?? -1);
const amRecastooor =
isStateAdded(memodRecasts ?? [], castHash) || optimisticRecasts || allRecastooors.includes(user?.fid ?? -1);
const amUpvotooor =
(curation?.upvotes ?? []).find((upvote) => upvote.voterFid === (user?.fid ?? -1)) || optimisticUpvotes;
const amDownvotooor =
(curation?.downvotes ?? []).find((downvote) => downvote.voterFid === (user?.fid ?? -1)) || optimisticDownvotes;

return showReactions ? (
<>
Expand All @@ -166,32 +130,6 @@ export const Reactions: React.FC<ReactionsProps> = ({
<BaseDivider type="vertical" style={{ marginLeft: reactionBarMarginSize }} />
<BarChartBigIcon size={reactionIconSize * 1.2} onClick={() => setAnalyticsOpen(!isAnalyticsOpen)} />
<BaseDivider type="vertical" style={{ marginLeft: reactionBarMarginSize }} />
{curation ? (
<>
<BaseDivider type="vertical" style={{ marginLeft: reactionBarMarginSize }} />
<BaseBadge
count={(curation?.upvotes?.length ?? 0) + optimisticUpvotes}
color={amUpvotooor ? highlightedColor : shadedColor}
>
{optimisticUpvotes ? (
<LucideThumbsUp size={reactionIconSize} />
) : (
<LucideThumbsUp size={reactionIconSize} onClick={() => handleUpvote(castHash, castFid)} />
)}
</BaseBadge>
<BaseDivider type="vertical" style={{ marginLeft: reactionBarMarginSize }} />
<BaseBadge
count={(curation?.downvotes?.length ?? 0) + optimisticDownvotes}
color={amDownvotooor ? highlightedColor : shadedColor}
>
{optimisticDownvotes ? (
<LucideThumbsDown size={reactionIconSize} />
) : (
<LucideThumbsDown size={reactionIconSize} onClick={() => handleDownvote(castHash, castFid)} />
)}
</BaseBadge>
</>
) : null}
</S.Description>
{isAnalyticsOpen && (
<ReactionsAnalytics
Expand Down
11 changes: 1 addition & 10 deletions src/components/header/layouts/DesktopHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const DesktopHeader: React.FC<DesktopHeaderProps> = ({ isTwoColumnsLayout
const isForYouFeed = pathname.startsWith('/foryou');
const isChannelFeed = pathname.startsWith('/~/channel/');
const isDecentBookmarksPage = pathname.startsWith('/external/decent-bookmarks');
const isVotePage = pathname.startsWith('/votes');

const leftSide = isTwoColumnsLayout ? (
<S.SearchColumn xl={16} xxl={17}>
Expand Down Expand Up @@ -56,15 +55,7 @@ export const DesktopHeader: React.FC<DesktopHeaderProps> = ({ isTwoColumnsLayout
</BaseCol>
)}
<BaseCol>
{isChannelFeed ? (
<ChannelLogo />
) : isHomeFeed || isForYouFeed ? (
<S.CCAButton />
) : isVotePage ? (
<S.CCAButton />
) : (
<S.FCButton />
)}
{isChannelFeed ? <ChannelLogo /> : isHomeFeed || isForYouFeed ? <S.CCAButton /> : <S.FCButton />}
</BaseCol>
</>
);
Expand Down
3 changes: 0 additions & 3 deletions src/components/header/layouts/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const MobileHeader: React.FC<MobileHeaderProps> = ({ toggleSider, isSider
const isForYouFeed = pathname.startsWith('/foryou');
const isChannelFeed = pathname.startsWith('/~/channel/');
const isDecentBookmarksPage = pathname.startsWith('/external/decent-bookmarks');
const isVotePage = pathname.startsWith('/votes');

return (
<>
Expand Down Expand Up @@ -50,8 +49,6 @@ export const MobileHeader: React.FC<MobileHeaderProps> = ({ toggleSider, isSider
<S.CCAButton />
) : isDecentBookmarksPage ? (
<S.DBmButton />
) : isVotePage ? (
<S.CCAButton />
) : (
<S.FCButton />
)}
Expand Down
6 changes: 0 additions & 6 deletions src/components/layouts/main/sider/sidebarNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ export const sidebarNavigation: SidebarNavigationItem[] = [
icon: <CheckCircleOutlined />,
url: '/curated-channels',
},
{
title: 'sidebar.votes',
key: 'votes',
icon: <ThumbsUpIcon />,
url: '/votes',
},
{
title: 'sidebar.bookmarks',
key: 'bookmarks',
Expand Down
3 changes: 0 additions & 3 deletions src/components/router/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const FollowingFeedPage = React.lazy(() => import('@app/pages/FollowingFeedPage'
const ForYouFeedPage = React.lazy(() => import('@app/pages/ForYouFeedPage'));
const CuratedChannelsPage = React.lazy(() => import('@app/pages/CuratedChannelsPage'));
const SponsorshipPage = React.lazy(() => import('@app/pages/SponsorshipPage'));
const VotesPage = React.lazy(() => import('@app/pages/VotesPage'));
const Error404Page = React.lazy(() => import('@app/pages/Error404Page'));

const Landing = withLoading(LandingPage);
Expand All @@ -21,7 +20,6 @@ const ForYouFeed = withLoading(ForYouFeedPage);
const Bookmarks = withLoading(BookmarksPage);
const Sponsorship = withLoading(SponsorshipPage);
const CuratedChannels = withLoading(CuratedChannelsPage);
const Votes = withLoading(VotesPage);

const Error404 = withLoading(Error404Page);

Expand All @@ -45,7 +43,6 @@ export const AppRouter: React.FC = () => {
</Route>
<Route path="sponsorship" element={<Sponsorship />} />
<Route path="curated-channels" element={<CuratedChannels />} />
<Route path="votes" element={<Votes />} />
<Route path="about" element={<Landing />} />
<Route path="404" element={<Error404 />} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions src/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"feed": "Futter",
"foryou": "Für Sie",
"sponsorship": "Anzeige",
"votes": "Gemeinschaftsbewertungen"
"votes-deprecated": "Gemeinschaftsbewertungen"
},
"sponsorship": {
"leftCardTitle": "Sponsoren Sie die BCBHShow",
Expand All @@ -148,7 +148,7 @@
"transcripts": "Transkripte auf /paragraph",
"rightCardTitle": "Sponsoren der 1. un 2. Staffel"
},
"votes": {
"votes-deprecated": {
"title": "Gemeinschaftsbewertungen hoch runter 👍 / 👎",
"cast-action": "Die Cast Action wird 15 Aug 2024 veraltet.",
"instruction": "Bitte stimmen Sie über $DEGEN Tipps in Warpcast, Wildcard, Degencast.",
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"feed": "Feed",
"foryou": "For You",
"sponsorship": "Sponsorship",
"votes": "Community Curation"
"votes-deprecated": "Community Curation - deprecated"
},
"sponsorship": {
"leftCardTitle": "Sponsor the BCBHShow",
Expand All @@ -148,7 +148,7 @@
"transcripts": "Transcripts on /paragraph",
"rightCardTitle": "Season 1 and 2 Sponsors"
},
"votes": {
"votes-deprecated": {
"title": "Up/down community curation 👍 / 👎",
"cast-action": "Cast Action will be deprecated 15 Aug 2024.",
"instruction": "Please vote via $DEGEN tips in Warpcast, Wildcard, Degencast.",
Expand Down
4 changes: 2 additions & 2 deletions src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"feed": "Noticias",
"foryou": "Para Ud.",
"sponsorship": "Patrocinio",
"votes": "Curación comunitaria"
"votes-deprecated": "Curación comunitaria"
},
"sponsorship": {
"leftCardTitle": "Para patrocinar el BCBHShow",
Expand All @@ -148,7 +148,7 @@
"transcripts": "Transcripciones en /paragraph",
"rightCardTitle": "Patrocinadores de las temporadas 1 y 2"
},
"votes": {
"votes-deprecated": {
"title": "Curación comunitaria por arriba y abajo 👍 / 👎",
"cast-action": "La acción de Cast se desaconseja 15 Agosto 2024.",
"instruction": "Vota con propinas de$DEGEN en Warpcast, Wildcard, Degencast.",
Expand Down
4 changes: 2 additions & 2 deletions src/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"feed": "フィード",
"foryou": "あなたのために",
"sponsorship": "スポンサーシップ",
"votes": "投票"
"votes-deprecated": "投票"
},
"sponsorship": {
"leftCardTitle": "BCBHShow のスポンサー",
Expand All @@ -148,7 +148,7 @@
"transcripts": "/paragraphでトランスクリプトを確認",
"rightCardTitle": "シーニズン1のスポンサー"
},
"votes": {
"votes-deprecated": {
"title": "コミュニティによる賛成票と反対票👍/👎",
"cast-action": "Cast Actionは15月8日に非推奨になります。",
"instruction": "Warpcast、Wildcard、Degencast で $DEGEN のヒントに投票してください。",
Expand Down
Loading

0 comments on commit 631cf48

Please sign in to comment.