-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
242 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useBlueskyStore } from '../store'; | ||
|
||
export function usePost({ handle, rkey }: { handle: string; rkey: string }) { | ||
const agent = useBlueskyStore((store) => store.agent); | ||
|
||
return useQuery({ | ||
queryKey: ['post', { handle, rkey }], | ||
queryFn: async () => { | ||
const response = await agent.getPost({ repo: handle, rkey }); | ||
return response.value; | ||
}, | ||
enabled: !!agent && !!handle, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 22 additions & 12 deletions
34
src/routes/notifications/components/FollowNotification.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
import { Avatar } from '@/components/ui/avatar'; | ||
import { Link } from '@/components/ui/Link'; | ||
import { BSkyFollowNotification } from '@/lib/bluesky/types/BSkyNotification'; | ||
import { UserPlus2 } from 'lucide-react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export function FollowNotification({ notification }: { notification: BSkyFollowNotification }) { | ||
const { t } = useTranslation('notifications'); | ||
return ( | ||
<Link | ||
to="/profile/$handle" | ||
params={{ | ||
handle: notification.author.handle, | ||
}} | ||
className="hover:no-underline" | ||
> | ||
<div className="p-2"> | ||
<div className="flex flex-row gap-1 overflow-hidden max-h-16"> | ||
<Avatar handle={notification.author.handle} avatar={notification.author.avatar} className="size-8 " /> | ||
<div className="p-2"> | ||
<div className="flex flex-row gap-2 p-2"> | ||
<div className="flex flex-shrink-0 w-12 justify-end aspect-square"> | ||
<UserPlus2 className="stroke-blue-400 size-6" /> | ||
</div> | ||
<div> | ||
{notification.author.displayName} {t('followedYou')} | ||
<Link | ||
to="/profile/$handle" | ||
params={{ | ||
handle: notification.author.handle, | ||
}} | ||
className="hover:no-underline" | ||
> | ||
<div className="flex flex-row gap-2"> | ||
<div className="flex flex-row gap-1 overflow-hidden max-h-16"> | ||
<Avatar handle={notification.author.handle} avatar={notification.author.avatar} className="size-8" /> | ||
</div> | ||
<div> | ||
{notification.author.displayName} {t('followedYou')} | ||
</div> | ||
</div> | ||
</Link> | ||
</div> | ||
</div> | ||
</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.