Prettier format pending files

This commit is contained in:
Builder.io 2025-10-18 21:16:04 +00:00
parent d4bc0af678
commit 8d91ee5443
5 changed files with 59 additions and 17 deletions

View file

@ -71,7 +71,11 @@ export function FeedItemCard({
if (!content) return;
setSubmittingComment(true);
try {
const created = await communityService.addComment(item.id, user.id, content);
const created = await communityService.addComment(
item.id,
user.id,
content,
);
if (created) {
setComments((prev) => [...prev, created]);
setCommentText("");
@ -219,23 +223,35 @@ export function FeedItemCard({
<div className="rounded-2xl border border-border/40 bg-background/80 p-4 space-y-3">
<div className="space-y-2 max-h-60 overflow-auto pr-1">
{loadingComments ? (
<p className="text-sm text-muted-foreground">Loading comments</p>
<p className="text-sm text-muted-foreground">
Loading comments
</p>
) : comments.length === 0 ? (
<p className="text-sm text-muted-foreground">Be the first to comment.</p>
<p className="text-sm text-muted-foreground">
Be the first to comment.
</p>
) : (
comments.map((c) => (
<div key={c.id} className="flex items-start gap-3">
<Avatar className="h-8 w-8">
<AvatarImage src={c.user_profiles?.avatar_url || undefined} />
<AvatarImage
src={c.user_profiles?.avatar_url || undefined}
/>
<AvatarFallback>
{(c.user_profiles?.full_name || c.user_profiles?.username || "U")[0]?.toUpperCase() || "U"}
{(c.user_profiles?.full_name ||
c.user_profiles?.username ||
"U")[0]?.toUpperCase() || "U"}
</AvatarFallback>
</Avatar>
<div>
<div className="text-sm font-medium">
{c.user_profiles?.full_name || c.user_profiles?.username || "Member"}
{c.user_profiles?.full_name ||
c.user_profiles?.username ||
"Member"}
</div>
<div className="text-sm text-foreground/90 whitespace-pre-wrap">
{c.content}
</div>
<div className="text-sm text-foreground/90 whitespace-pre-wrap">{c.content}</div>
</div>
</div>
))
@ -248,7 +264,10 @@ export function FeedItemCard({
onChange={(e) => setCommentText(e.target.value)}
className="min-h-[44px]"
/>
<Button onClick={submitComment} disabled={submittingComment || !commentText.trim()}>
<Button
onClick={submitComment}
disabled={submittingComment || !commentText.trim()}
>
{submittingComment ? "Posting…" : "Post"}
</Button>
</div>

View file

@ -112,10 +112,18 @@ export default function PostComposer({
? "New photo"
: "Update");
const inlineTags = Array.from((text.match(/#[\p{L}0-9_]+/gu) || []).map((t) => t.replace(/^#/, "").toLowerCase()));
const inlineTags = Array.from(
(text.match(/#[\p{L}0-9_]+/gu) || []).map((t) =>
t.replace(/^#/, "").toLowerCase(),
),
);
const baseTags = mediaType === "none" ? ["update"] : [mediaType, "feed"];
const combinedTags = Array.from(
new Set([...baseTags, ...selectedTags.map((t) => t.toLowerCase()), ...inlineTags]).values(),
new Set([
...baseTags,
...selectedTags.map((t) => t.toLowerCase()),
...inlineTags,
]).values(),
);
await communityService.createPost({

View file

@ -245,7 +245,9 @@ export default function Feed() {
const handleComment = useCallback((postId: string) => {
setItems((prev) =>
prev.map((it) => (it.id === postId ? { ...it, comments: it.comments + 1 } : it)),
prev.map((it) =>
it.id === postId ? { ...it, comments: it.comments + 1 } : it,
),
);
}, []);
@ -452,7 +454,9 @@ export default function Feed() {
</div>
<PostComposer
onPosted={() => fetchFeed()}
suggestedTags={trendingTopics.map((t) => t.topic.replace(/^#/, "")).slice(0, 8)}
suggestedTags={trendingTopics
.map((t) => t.topic.replace(/^#/, ""))
.slice(0, 8)}
/>
<div className="flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/30 bg-background/60 p-4 text-sm text-muted-foreground">
<div className="flex items-center gap-2">

View file

@ -336,16 +336,23 @@ export default function Staff() {
</div>
<div className="rounded border border-border/50">
{users.length === 0 ? (
<p className="p-3 text-sm text-muted-foreground">No users found.</p>
<p className="p-3 text-sm text-muted-foreground">
No users found.
</p>
) : (
<div className="divide-y divide-border/50">
{users.map((u) => (
<div key={u.id} className="flex items-center justify-between p-3">
<div
key={u.id}
className="flex items-center justify-between p-3"
>
<div>
<div className="text-sm font-medium">
{u.full_name || u.username || u.id}
</div>
<div className="text-xs text-muted-foreground">{u.username}</div>
<div className="text-xs text-muted-foreground">
{u.username}
</div>
</div>
<Badge variant="outline" className="capitalize">
{u.user_type || "unknown"}

View file

@ -1183,11 +1183,15 @@ export function createServer() {
// Staff: users search/listing
app.get("/api/staff/users", async (req, res) => {
const limit = Math.max(1, Math.min(50, Number(req.query.limit) || 20));
const q = String(req.query.q || "").trim().toLowerCase();
const q = String(req.query.q || "")
.trim()
.toLowerCase();
try {
const { data, error } = await adminSupabase
.from("user_profiles")
.select("id, username, full_name, avatar_url, user_type, created_at, updated_at")
.select(
"id, username, full_name, avatar_url, user_type, created_at, updated_at",
)
.order("created_at", { ascending: false })
.limit(limit);
if (error) return res.status(500).json({ error: error.message });