diff --git a/packages/app/src/Components/Button/IconButton.tsx b/packages/app/src/Components/Button/IconButton.tsx index 760a4352..023727e9 100644 --- a/packages/app/src/Components/Button/IconButton.tsx +++ b/packages/app/src/Components/Button/IconButton.tsx @@ -12,7 +12,12 @@ interface IconButtonProps { const IconButton = ({ onClick, icon, children, className }: IconButtonProps) => { return ( - diff --git a/packages/app/src/Components/RightWidgets/articles.tsx b/packages/app/src/Components/RightWidgets/articles.tsx new file mode 100644 index 00000000..56f0d2da --- /dev/null +++ b/packages/app/src/Components/RightWidgets/articles.tsx @@ -0,0 +1,68 @@ +import { NostrLink } from "@snort/system"; +import { useState } from "react"; +import { FormattedMessage } from "react-intl"; +import { Link } from "react-router-dom"; + +import { useArticles } from "@/Feed/ArticlesFeed"; +import { findTag } from "@/Utils"; + +import IconButton from "../Button/IconButton"; +import { ProxyImg } from "../ProxyImg"; +import ProfilePreview from "../User/ProfilePreview"; +import { BaseWidget } from "./base"; + +export default function LatestArticlesWidget() { + const [idx, setIdx] = useState(0); + const articles = useArticles(); + const selected = articles.at(idx); + + function next(i: number) { + setIdx(x => { + x += i; + if (x < 0) { + x = articles.length - 1; + } else if (x > articles.length) { + x = 0; + } + return x; + }); + } + + if (!selected) return; + const link = NostrLink.fromEvent(selected); + const image = findTag(selected, "image"); + const title = findTag(selected, "title"); + return ( + }> +
+ + {image ? ( + + ) : ( +
+ )} +
+ {title} +
+ +
+ , + }} + actions={ +
+ next(-1)} /> + next(1)} /> +
+ } + /> +
+
+
+ ); +} diff --git a/packages/app/src/Components/RightWidgets/base.tsx b/packages/app/src/Components/RightWidgets/base.tsx index 17790993..225fbb44 100644 --- a/packages/app/src/Components/RightWidgets/base.tsx +++ b/packages/app/src/Components/RightWidgets/base.tsx @@ -11,16 +11,16 @@ export interface BaseWidgetProps { } export function BaseWidget({ children, title, icon, iconClassName, contextMenu }: BaseWidgetProps) { return ( -
+
{title && (
-
+
{icon && (
)} -
{title}
+
{title}
{contextMenu}
diff --git a/packages/app/src/Components/RightWidgets/index.tsx b/packages/app/src/Components/RightWidgets/index.tsx index db457427..dadc6334 100644 --- a/packages/app/src/Components/RightWidgets/index.tsx +++ b/packages/app/src/Components/RightWidgets/index.tsx @@ -3,7 +3,7 @@ export enum RightColumnWidget { TrendingNotes, TrendingPeople, TrendingHashtags, - TrendingArticls, + LatestArticls, LiveStreams, InviteFriends, } diff --git a/packages/app/src/Pages/Deck/Articles.tsx b/packages/app/src/Pages/Deck/Articles.tsx index 0ff1b53a..966b0b79 100644 --- a/packages/app/src/Pages/Deck/Articles.tsx +++ b/packages/app/src/Pages/Deck/Articles.tsx @@ -1,15 +1,10 @@ import { useContext } from "react"; +import Note, { NoteProps } from "@/Components/Event/EventComponent"; import { useArticles } from "@/Feed/ArticlesFeed"; import { DeckContext } from "@/Pages/Deck/DeckLayout"; -import Note from "../../Components/Event/EventComponent"; - -const options = { - longFormPreview: true, -}; - -export default function Articles() { +export default function Articles({ noteProps }: { noteProps?: Omit }) { const data = useArticles(); const deck = useContext(DeckContext); @@ -19,9 +14,14 @@ export default function Articles() { { deck?.setArticle(ev); + noteProps?.onClick?.(ev); }} /> ))} diff --git a/packages/app/src/Pages/Layout/RightColumn.tsx b/packages/app/src/Pages/Layout/RightColumn.tsx index 5fb9a123..188dc501 100644 --- a/packages/app/src/Pages/Layout/RightColumn.tsx +++ b/packages/app/src/Pages/Layout/RightColumn.tsx @@ -2,6 +2,7 @@ import classNames from "classnames"; import { FormattedMessage } from "react-intl"; import { RightColumnWidget } from "@/Components/RightWidgets"; +import LatestArticlesWidget from "@/Components/RightWidgets/articles"; import { BaseWidget } from "@/Components/RightWidgets/base"; import InviteFriendsWidget from "@/Components/RightWidgets/invite-friends"; import MiniStreamWidget from "@/Components/RightWidgets/mini-stream"; @@ -23,6 +24,7 @@ export default function RightColumn() { RightColumnWidget.InviteFriends, //RightColumnWidget.LiveStreams, RightColumnWidget.TrendingNotes, + RightColumnWidget.LatestArticls, RightColumnWidget.TrendingPeople, RightColumnWidget.TrendingHashtags, ] @@ -65,6 +67,8 @@ export default function RightColumn() { return ; case RightColumnWidget.LiveStreams: return ; + case RightColumnWidget.LatestArticls: + return ; } }; diff --git a/packages/app/src/index.css b/packages/app/src/index.css index dc9e43d4..72a95544 100644 --- a/packages/app/src/index.css +++ b/packages/app/src/index.css @@ -175,6 +175,10 @@ a.ext { -webkit-text-fill-color: transparent; } +.text-outline { + -webkit-text-stroke: 1px black; +} + .br { border-radius: 16px; } @@ -941,6 +945,7 @@ svg.repeat { .pb-safe-area-plus-footer { padding-bottom: calc(env(safe-area-inset-bottom) + 56px); } + .sm-hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index 61c280f9..6fa50044 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -183,6 +183,9 @@ "2ukA4d": { "defaultMessage": "{n} hours" }, + "2z7Kky": { + "defaultMessage": "Latest Articles" + }, "3/onCd": { "defaultMessage": "Replies" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index 431ca494..df0e6479 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -60,6 +60,7 @@ "2oCF7O": "Followed by friends of friends", "2raFAu": "Application-specific data", "2ukA4d": "{n} hours", + "2z7Kky": "Latest Articles", "3/onCd": "Replies", "39AHJm": "Sign Up", "3GWu6/": "User Statuses", diff --git a/packages/app/tailwind.config.js b/packages/app/tailwind.config.js index 839d3de4..73977f01 100644 --- a/packages/app/tailwind.config.js +++ b/packages/app/tailwind.config.js @@ -28,6 +28,7 @@ module.exports = { }, textColor: { secondary: "var(--font-secondary-color)", + "font-color": "var(--font-color)", }, spacing: { px: "1px",