feat: improve

This commit is contained in:
reya
2024-04-10 14:11:05 +07:00
parent 5e6692cd6d
commit c342daecc8
26 changed files with 992 additions and 789 deletions
+5 -3
View File
@@ -1,7 +1,7 @@
import { ColumnRouteSearch } from "@lume/types";
import { Column } from "@lume/ui";
import { TOPICS, cn } from "@lume/utils";
import { createFileRoute } from "@tanstack/react-router";
import { createFileRoute, useRouter } from "@tanstack/react-router";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
@@ -19,12 +19,14 @@ export const Route = createFileRoute("/interests")({
function Screen() {
const { t } = useTranslation();
const { label, name } = Route.useSearch();
const { label, name, redirect } = Route.useSearch();
const { ark } = Route.useRouteContext();
const [hashtags, setHashtags] = useState<string[]>([]);
const [isDone, setIsDone] = useState(false);
const router = useRouter();
const toggleHashtag = (item: string) => {
const arr = hashtags.includes(item)
? hashtags.filter((i) => i !== item)
@@ -40,7 +42,7 @@ function Screen() {
const submit = async () => {
try {
if (isDone) {
return history.back();
return router.history.push(redirect);
}
const eventId = await ark.set_interest(undefined, undefined, hashtags);