Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions frontend/src/components/GalleryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faDownload, faStar } from "@fortawesome/free-solid-svg-icons";
import { Link } from "react-router";
import { GALLERY_TYPE_BADGES } from "@/components/gallery/GalleryListingPreview";
import { userAvatarUrl } from "@/lib/discord-cdn";

interface GalleryCardProps {
listing: GalleryListing;
Expand Down Expand Up @@ -119,13 +120,11 @@ const GalleryCard: FC<GalleryCardProps> = ({
</span>
)}
<span className="text-gray-400 flex items-center gap-1.5">
{listing.submitted_user.avatar_url ? (
<img
src={listing.submitted_user.avatar_url}
alt=""
className="w-4 h-4 rounded-full"
/>
) : null}
<img
src={userAvatarUrl(listing.submitted_user.id, listing.submitted_user.avatar_url)}
alt=""
className="w-4 h-4 rounded-full"
/>
{listing.submitted_user.username}
</span>
</div>
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/components/modals/GalleryPreviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import GalleryListingPreview, {
GALLERY_TYPE_BADGES,
listingHasMarkdown,
} from "@/components/gallery/GalleryListingPreview";
import { userAvatarUrl } from "@/lib/discord-cdn";
import type { GallerySubmission } from "@/types";

type PreviewView = "rendered" | "raw";
Expand Down Expand Up @@ -108,13 +109,11 @@ const GalleryPreviewModal: FC<GalleryPreviewModalProps> = ({ listing, open, onCl
</MetaRow>
<MetaRow label="Submitted by">
<span className="inline-flex items-center gap-1.5">
{listing.submitted_user.avatar_url && (
<img
src={listing.submitted_user.avatar_url}
alt=""
className="w-4 h-4 rounded-full"
/>
)}
<img
src={userAvatarUrl(listing.submitted_user.id, listing.submitted_user.avatar_url)}
alt=""
className="w-4 h-4 rounded-full"
/>
{listing.submitted_user.username}
</span>
</MetaRow>
Expand Down
16 changes: 9 additions & 7 deletions frontend/src/pages/admin/gallery/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState, useEffect, useCallback, useId, useMemo, type FC } from "react";
import { apiClient } from "@/lib/api";
import { userAvatarUrl } from "@/lib/discord-cdn";
import { toast } from "sonner";
import type { GallerySubmission } from "@/types";
import Button from "@/components/Button";
Expand Down Expand Up @@ -224,13 +225,14 @@ const AdminGalleryPage: FC = () => {
</div>
<div className="text-xs text-gray-500 mt-1 flex items-center gap-1.5">
by
{submission.submitted_user.avatar_url && (
<img
src={submission.submitted_user.avatar_url}
alt=""
className="w-4 h-4 rounded-full inline"
/>
)}
<img
src={userAvatarUrl(
submission.submitted_user.id,
submission.submitted_user.avatar_url,
)}
alt=""
className="w-4 h-4 rounded-full inline"
/>
{submission.submitted_user.username} &middot; {date}
</div>
</div>
Expand Down
23 changes: 7 additions & 16 deletions frontend/src/pages/gallery/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useParams, Link } from "react-router";
import { MainLayout } from "@/pages/layout/Main";
import Button from "@/components/Button";
import { apiClient } from "@/lib/api";
import { userAvatarUrl } from "@/lib/discord-cdn";
import type { GalleryListing } from "@/types";
import GalleryImportModal from "@/components/modals/GalleryImportModal";
import GalleryImportTagModal from "@/components/modals/GalleryImportTagModal";
Expand All @@ -12,13 +13,7 @@ import GalleryListingPreview, {
GALLERY_TYPE_BADGES,
} from "@/components/gallery/GalleryListingPreview";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faArrowLeft,
faDownload,
faStar,
faClock,
faUser,
} from "@fortawesome/free-solid-svg-icons";
import { faArrowLeft, faDownload, faStar, faClock } from "@fortawesome/free-solid-svg-icons";

function getImportButtonLabel(type: string): string {
if (type === "tag") return "Import Tag";
Expand Down Expand Up @@ -131,15 +126,11 @@ const GalleryViewPage: FC = () => {

<div className="space-y-2 text-sm text-gray-400 mb-6">
<div className="flex items-center gap-2">
{listing.submitted_user.avatar_url ? (
<img
src={listing.submitted_user.avatar_url}
alt=""
className="w-5 h-5 rounded-full"
/>
) : (
<FontAwesomeIcon icon={faUser} className="w-4" aria-hidden="true" />
)}
<img
src={userAvatarUrl(listing.submitted_user.id, listing.submitted_user.avatar_url)}
alt=""
className="w-5 h-5 rounded-full"
/>
<span>{listing.submitted_user.username}</span>
</div>
<div className="flex items-center gap-2">
Expand Down
Loading