From c285ec27148aaa2e36b736ebcc0bb6997bfee536 Mon Sep 17 00:00:00 2001 From: Hamzat Victor Date: Fri, 9 Feb 2024 12:01:09 +0100 Subject: [PATCH] feat: update the tweet content of quotes --- src/components/inc/QuoteCard.tsx | 12 ++++-------- src/components/inc/widgets/Quotes.tsx | 6 +----- src/utils/index.ts | 4 +++- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/components/inc/QuoteCard.tsx b/src/components/inc/QuoteCard.tsx index e513743..6b0fcc8 100644 --- a/src/components/inc/QuoteCard.tsx +++ b/src/components/inc/QuoteCard.tsx @@ -6,7 +6,7 @@ import { EditIcon, } from "@components/icons"; import { tweetHandler } from "@utils"; -import { Flex, Text, Box, IconButton } from "@components/base"; +import { Flex, Text, IconButton } from "@components/base"; import { Quote } from "@store/slices/QuotesSlice"; import useStore from "@store"; import { shallow } from "zustand/shallow"; @@ -23,7 +23,7 @@ export function QuoteCard(props: QuoteCardProps) { const { id, text, author } = props.quote; const [favouriteQuotes, setFavouriteQuotes] = useStore( (state) => [state.favouriteQuotes, state.setFavouriteQuotes], - shallow + shallow, ); const tweetText = `I love this quote by ${author}! “${text}”`; @@ -33,7 +33,7 @@ export function QuoteCard(props: QuoteCardProps) { function ToggleFavorite(quoteId: string) { if (isFavorite(quoteId)) { setFavouriteQuotes( - favouriteQuotes.filter((favQuote) => favQuote.id !== quoteId) + favouriteQuotes.filter((favQuote) => favQuote.id !== quoteId), ); } else { setFavouriteQuotes([...favouriteQuotes, props.quote]); @@ -104,11 +104,7 @@ export function QuoteCard(props: QuoteCardProps) { diff --git a/src/components/inc/widgets/Quotes.tsx b/src/components/inc/widgets/Quotes.tsx index 7fad2c2..9d26f5c 100644 --- a/src/components/inc/widgets/Quotes.tsx +++ b/src/components/inc/widgets/Quotes.tsx @@ -120,11 +120,7 @@ function Quotes() { size: 10, }, }} - href={tweetHandler( - tweetText, - ["chroma", "inspring", "inspirational"], - "chroma", - )} + href={tweetHandler(tweetText)} target="_blank" rel="noreferrer" > diff --git a/src/utils/index.ts b/src/utils/index.ts index c85ca16..4cd601d 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -115,7 +115,9 @@ export function handleGoals() { } } -export function tweetHandler(text: string, hashtags: string[], via: string) { +export function tweetHandler(text: string) { + const hashtags = ["paige_devmotion", "inspring", "inspirational"]; + const via = "paige_devmotion"; const baseUrl = "https://twitter.com/intent/tweet"; const url = `${baseUrl}?text=${encodeURI( text,