feat: update frontend to work with v2 backend — camelCase, new endpoints, nested author
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m38s
test / unit (pull_request) Successful in 16m2s
test / integration (pull_request) Failing after 17m2s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m38s
test / unit (pull_request) Successful in 16m2s
test / integration (pull_request) Failing after 17m2s
This commit is contained in:
@@ -64,7 +64,7 @@ export function ApiKeyList({ initialApiKeys }: ApiKeyListProps) {
|
||||
try {
|
||||
const newKeyResponse = await createApiKey(values, token);
|
||||
setKeys((prev) => [...prev, newKeyResponse]);
|
||||
setNewKey(newKeyResponse.plaintextKey ?? null);
|
||||
setNewKey(newKeyResponse.key ?? null);
|
||||
form.reset();
|
||||
toast.success("API Key created successfully.");
|
||||
} catch {
|
||||
@@ -113,7 +113,7 @@ export function ApiKeyList({ initialApiKeys }: ApiKeyListProps) {
|
||||
{`Created on ${format(key.createdAt, "PPP")}`}
|
||||
</p>
|
||||
<p className="text-xs font-mono text-muted-foreground mt-1">
|
||||
{`${key.keyPrefix}...`}
|
||||
{key.id}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -16,11 +16,9 @@ import {
|
||||
FormLabel,
|
||||
FormControl,
|
||||
FormMessage,
|
||||
FormDescription,
|
||||
} from "@/components/ui/form";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { TopFriendsCombobox } from "@/components/top-friends-combobox";
|
||||
|
||||
interface EditProfileFormProps {
|
||||
currentUser: Me;
|
||||
@@ -38,7 +36,6 @@ export function EditProfileForm({ currentUser }: EditProfileFormProps) {
|
||||
avatarUrl: currentUser.avatarUrl ?? undefined,
|
||||
headerUrl: currentUser.headerUrl ?? undefined,
|
||||
customCss: currentUser.customCss ?? undefined,
|
||||
topFriends: currentUser.topFriends ?? [],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -135,25 +132,6 @@ export function EditProfileForm({ currentUser }: EditProfileFormProps) {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
name="topFriends"
|
||||
control={form.control}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Top Friends</FormLabel>
|
||||
<FormControl>
|
||||
<TopFriendsCombobox
|
||||
value={field.value || []}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormDescription>
|
||||
Select up to 8 of your friends to display on your profile.
|
||||
</FormDescription>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
</CardContent>
|
||||
<CardFooter className="border-t px-6 py-4">
|
||||
<Button type="submit" disabled={form.formState.isSubmitting}>
|
||||
|
||||
@@ -35,7 +35,7 @@ export function PostThoughtForm() {
|
||||
|
||||
const form = useForm<z.infer<typeof CreateThoughtSchema>>({
|
||||
resolver: zodResolver(CreateThoughtSchema),
|
||||
defaultValues: { content: "", visibility: "Public" },
|
||||
defaultValues: { content: "", visibility: "public" },
|
||||
});
|
||||
|
||||
async function onSubmit(values: z.infer<typeof CreateThoughtSchema>) {
|
||||
@@ -93,19 +93,24 @@ export function PostThoughtForm() {
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectItem value="Public">
|
||||
<SelectItem value="public">
|
||||
<div className="flex items-center gap-2">
|
||||
<Globe className="h-4 w-4" /> Public
|
||||
</div>
|
||||
</SelectItem>
|
||||
<SelectItem value="FriendsOnly">
|
||||
<SelectItem value="followers">
|
||||
<div className="flex items-center gap-2">
|
||||
<Users className="h-4 w-4" /> Friends Only
|
||||
<Users className="h-4 w-4" /> Followers
|
||||
</div>
|
||||
</SelectItem>
|
||||
<SelectItem value="Private">
|
||||
<SelectItem value="unlisted">
|
||||
<div className="flex items-center gap-2">
|
||||
<Lock className="h-4 w-4" /> Private
|
||||
<Lock className="h-4 w-4" /> Unlisted
|
||||
</div>
|
||||
</SelectItem>
|
||||
<SelectItem value="direct">
|
||||
<div className="flex items-center gap-2">
|
||||
<Lock className="h-4 w-4" /> Direct
|
||||
</div>
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
|
||||
@@ -33,8 +33,8 @@ export function ReplyForm({ parentThoughtId, onReplySuccess }: ReplyFormProps) {
|
||||
resolver: zodResolver(CreateThoughtSchema),
|
||||
defaultValues: {
|
||||
content: "",
|
||||
replyToId: parentThoughtId,
|
||||
visibility: "Public", // Replies default to Public
|
||||
inReplyToId: parentThoughtId,
|
||||
visibility: "public",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ export function ThoughtCard({
|
||||
addSuffix: true,
|
||||
});
|
||||
|
||||
const isAuthor = currentUser?.username === thought.authorUsername;
|
||||
const isAuthor = currentUser?.username === thought.author.username;
|
||||
|
||||
const handleDelete = async () => {
|
||||
if (!token) return;
|
||||
|
||||
@@ -27,9 +27,9 @@ export function ThoughtList({
|
||||
<div className="space-y-6 p-4">
|
||||
{thoughts.map((thought) => {
|
||||
const author = {
|
||||
username: thought.authorUsername,
|
||||
displayName: thought.authorDisplayName,
|
||||
...authorDetails.get(thought.authorUsername),
|
||||
username: thought.author.username,
|
||||
displayName: thought.author.displayName,
|
||||
...authorDetails.get(thought.author.username),
|
||||
};
|
||||
return (
|
||||
<ThoughtCard
|
||||
|
||||
@@ -15,9 +15,9 @@ export function ThoughtThread({
|
||||
isReply = false,
|
||||
}: ThoughtThreadProps) {
|
||||
const author = {
|
||||
username: thought.authorUsername,
|
||||
displayName: thought.authorDisplayName,
|
||||
...authorDetails.get(thought.authorUsername),
|
||||
username: thought.author.username,
|
||||
displayName: thought.author.displayName,
|
||||
...authorDetails.get(thought.author.username),
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user