Skip to content

Commit

Permalink
✨ Add fallback url in author feed
Browse files Browse the repository at this point in the history
  • Loading branch information
foysalit committed Jan 10, 2025
1 parent edcac2d commit 00ac83f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
6 changes: 6 additions & 0 deletions components/common/feeds/AuthorFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,12 @@ export const useAuthorFeedQuery = ({
export function AuthorFeed({
id,
onReport,
isAuthorDeactivated,
isAuthorTakendown,
}: {
id: string
isAuthorDeactivated: boolean
isAuthorTakendown: boolean
onReport: (uri: string) => void
}) {
const [query, setQuery] = useState('')
Expand All @@ -154,6 +158,8 @@ export function AuthorFeed({
onLoadMore={hasNextPage ? () => fetchNextPage() : undefined}
typeFilter={typeFilter}
setTypeFilter={setTypeFilter}
isAuthorDeactivated={isAuthorDeactivated}
isAuthorTakendown={isAuthorTakendown}
/>
)
}
6 changes: 6 additions & 0 deletions components/common/posts/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export function Posts({
setSearchQuery,
typeFilter,
setTypeFilter,
isAuthorDeactivated,
isAuthorTakendown,
}: {
isFromAppview?: boolean
items: AppBskyFeedDefs.FeedViewPost[]
Expand All @@ -36,6 +38,8 @@ export function Posts({
setSearchQuery: (query: string) => void
typeFilter: TypeFilterKey
setTypeFilter: (type: TypeFilterKey) => void
isAuthorDeactivated: boolean
isAuthorTakendown: boolean
}) {
const [mode, setMode] = useState<Mode>(Mode.Feed)

Expand Down Expand Up @@ -103,6 +107,8 @@ export function Posts({
{mode === Mode.Feed ? (
<div className="mx-auto max-w-3xl w-full py-2 sm:py-4 sm:px-6 lg:px-8">
<PostsFeed
isAuthorDeactivated={isAuthorDeactivated}
isAuthorTakendown={isAuthorTakendown}
items={items}
onReport={onReport}
onLoadMore={onLoadMore}
Expand Down
12 changes: 11 additions & 1 deletion components/common/posts/PostsFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export function PostsFeed({
items,
onReport,
onLoadMore,
isAuthorDeactivated,
isAuthorTakendown,
}: {
items: AppBskyFeedDefs.FeedViewPost[]
onReport: (uri: string) => void
onLoadMore?: () => void
isAuthorDeactivated?: boolean
isAuthorTakendown?: boolean
}) {
return (
<div className="border border-gray-200 dark:border-slate-700 border-b-0">
Expand All @@ -64,7 +68,13 @@ export function PostsFeed({
key={`post-${i}`}
className="bg-white dark:bg-slate-800 border-b border-gray-200 dark:border-slate-700 pt-6 pb-4 px-4"
>
<PostAsCard item={item} onReport={onReport} dense />
<PostAsCard
item={item}
onReport={onReport}
dense
isAuthorDeactivated={isAuthorDeactivated}
isAuthorTakendown={isAuthorTakendown}
/>
</div>
))}
{onLoadMore && <LoadMore onLoadMore={onLoadMore} />}
Expand Down
24 changes: 21 additions & 3 deletions components/repositories/AccountView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,14 @@ export function AccountView({
<Details profile={profile} repo={repo} id={id} />
)}
{currentView === Views.Posts && (
<Posts id={id} onReport={setReportUri} />
<Posts
id={id}
onReport={setReportUri}
isAuthorTakendown={
!!repo.moderation?.subjectStatus?.takendown
}
isAuthorDeactivated={!!repo.deactivatedAt}
/>
)}
{currentView === Views.Follows && (
<Follows count={profile?.followsCount} id={id} />
Expand Down Expand Up @@ -640,7 +647,7 @@ function Details({
</LabelList>
</DataField>
<DataField label="Tags">
<LabelList className='flex-wrap gap-1'>
<LabelList className="flex-wrap gap-1">
{!tags.length && <LabelListEmpty />}
{tags.map((tag) => (
<SubjectTag key={tag} tag={tag} />
Expand Down Expand Up @@ -692,11 +699,22 @@ function Details({
function Posts({
id,
onReport,
isAuthorDeactivated,
isAuthorTakendown,
}: {
id: string
onReport: (uri: string) => void
isAuthorDeactivated: boolean
isAuthorTakendown: boolean
}) {
return <AuthorFeed id={id} onReport={onReport} />
return (
<AuthorFeed
id={id}
onReport={onReport}
isAuthorTakendown={isAuthorTakendown}
isAuthorDeactivated={isAuthorDeactivated}
/>
)
}

function Invites({ repo }: { repo: GetRepo.OutputSchema }) {
Expand Down

0 comments on commit 00ac83f

Please sign in to comment.