feat: display power purchase and tx
This commit is contained in:
parent
3c5b224904
commit
dbe7aee915
19
src/hono.ts
19
src/hono.ts
|
|
@ -2212,7 +2212,7 @@ declare const walletsRelations: drizzle_orm.Relations<"wallets", {
|
|||
transactionsFrom: drizzle_orm.Many<"transactions">;
|
||||
transactionTo: drizzle_orm.Many<"transactions">;
|
||||
}>;
|
||||
declare const transactionType: drizzle_orm_pg_core.PgEnum<["tip", "mint", "burn", "withdraw"]>;
|
||||
declare const transactionType: drizzle_orm_pg_core.PgEnum<["tip", "mint", "burn", "withdraw", "purchase"]>;
|
||||
declare const transactions: drizzle_orm_pg_core.PgTableWithColumns<{
|
||||
name: "transactions";
|
||||
schema: undefined;
|
||||
|
|
@ -2238,14 +2238,14 @@ declare const transactions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|||
tableName: "transactions";
|
||||
dataType: "string";
|
||||
columnType: "PgEnumColumn";
|
||||
data: "tip" | "mint" | "burn" | "withdraw";
|
||||
data: "tip" | "mint" | "burn" | "withdraw" | "purchase";
|
||||
driverParam: string;
|
||||
notNull: true;
|
||||
hasDefault: false;
|
||||
isPrimaryKey: false;
|
||||
isAutoincrement: false;
|
||||
hasRuntimeDefault: false;
|
||||
enumValues: ["tip", "mint", "burn", "withdraw"];
|
||||
enumValues: ["tip", "mint", "burn", "withdraw", "purchase"];
|
||||
baseColumn: never;
|
||||
generated: undefined;
|
||||
}, {}, {}>;
|
||||
|
|
@ -2366,7 +2366,7 @@ declare const transactions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|||
}>;
|
||||
declare const transactionsOpenAPISchema: zod.ZodObject<{
|
||||
hash: zod.ZodString;
|
||||
type: zod.ZodEnum<["tip", "mint", "burn", "withdraw"]>;
|
||||
type: zod.ZodEnum<["tip", "mint", "burn", "withdraw", "purchase"]>;
|
||||
fromUserId: zod.ZodNullable<zod.ZodString>;
|
||||
toUserId: zod.ZodNullable<zod.ZodString>;
|
||||
toFeedId: zod.ZodNullable<zod.ZodString>;
|
||||
|
|
@ -2375,7 +2375,7 @@ declare const transactionsOpenAPISchema: zod.ZodObject<{
|
|||
createdAt: zod.ZodString;
|
||||
comment: zod.ZodNullable<zod.ZodString>;
|
||||
}, zod.UnknownKeysParam, zod.ZodTypeAny, {
|
||||
type: "tip" | "mint" | "burn" | "withdraw";
|
||||
type: "tip" | "mint" | "burn" | "withdraw" | "purchase";
|
||||
createdAt: string;
|
||||
hash: string;
|
||||
fromUserId: string | null;
|
||||
|
|
@ -2385,7 +2385,7 @@ declare const transactionsOpenAPISchema: zod.ZodObject<{
|
|||
powerToken: string;
|
||||
comment: string | null;
|
||||
}, {
|
||||
type: "tip" | "mint" | "burn" | "withdraw";
|
||||
type: "tip" | "mint" | "burn" | "withdraw" | "purchase";
|
||||
createdAt: string;
|
||||
hash: string;
|
||||
fromUserId: string | null;
|
||||
|
|
@ -2584,7 +2584,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
|
|||
output: {
|
||||
code: 0;
|
||||
data: {
|
||||
type: "tip" | "mint" | "burn" | "withdraw";
|
||||
type: "tip" | "mint" | "burn" | "withdraw" | "purchase";
|
||||
createdAt: string;
|
||||
hash: string;
|
||||
fromUserId: string | null;
|
||||
|
|
@ -2731,10 +2731,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
|
|||
input: {};
|
||||
output: {
|
||||
code: 0;
|
||||
data: {
|
||||
address: string;
|
||||
addressIndex: number;
|
||||
};
|
||||
data: string;
|
||||
};
|
||||
outputFormat: "json" | "text";
|
||||
status: 200;
|
||||
|
|
|
|||
|
|
@ -35,20 +35,8 @@ import { SettingsTitle } from "../title"
|
|||
export const SettingInvitations = () => {
|
||||
const invitations = useAuthQuery(Queries.invitations.list())
|
||||
|
||||
const newInvitation = useMutation({
|
||||
mutationKey: ["newInvitation"],
|
||||
mutationFn: () => apiClient.invitations.new.$post(),
|
||||
async onError(err) {
|
||||
toast.error(getFetchErrorMessage(err))
|
||||
},
|
||||
onSuccess(data) {
|
||||
Queries.invitations.list().invalidate()
|
||||
toast("🎉 New invitation generated, invite code is copied")
|
||||
navigator.clipboard.writeText(data.data)
|
||||
},
|
||||
})
|
||||
const presentUserProfile = usePresentUserProfileModal("drawer")
|
||||
const { present } = useModalStack()
|
||||
const presentUserProfile = usePresentUserProfileModal("drawer")
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -69,24 +57,7 @@ export const SettingInvitations = () => {
|
|||
onClick={() => {
|
||||
present({
|
||||
title: "Confirm",
|
||||
content: ({ dismiss }) => (
|
||||
<>
|
||||
<div className="flex items-center">
|
||||
<span>Generating an invitation code will cost you 10 </span><i className="i-mgc-power mx-1 text-base" /><span>Power. Do you want to continue?</span>
|
||||
</div>
|
||||
<div className="mt-4 flex items-center justify-end gap-3">
|
||||
<Button variant="outline" onClick={dismiss}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
isLoading={newInvitation.isPending}
|
||||
onClick={() => newInvitation.mutateAsync().then(() => dismiss())}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
),
|
||||
content: ({ dismiss }) => <ConfirmModalContent dismiss={dismiss} />,
|
||||
})
|
||||
}}
|
||||
>
|
||||
|
|
@ -173,16 +144,6 @@ export const SettingInvitations = () => {
|
|||
(
|
||||
<div className="mt-36 w-full text-center text-sm text-zinc-400">
|
||||
<p>No invitations</p>
|
||||
|
||||
<div className="mt-6">
|
||||
<Button
|
||||
onClick={() => {
|
||||
newInvitation.mutate()
|
||||
}}
|
||||
>
|
||||
Create Invitation
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</ScrollArea.ScrollArea>
|
||||
|
|
@ -191,3 +152,42 @@ export const SettingInvitations = () => {
|
|||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const ConfirmModalContent = ({
|
||||
dismiss,
|
||||
}: {
|
||||
dismiss: () => void
|
||||
}) => {
|
||||
const newInvitation = useMutation({
|
||||
mutationKey: ["newInvitation"],
|
||||
mutationFn: () => apiClient.invitations.new.$post(),
|
||||
async onError(err) {
|
||||
toast.error(getFetchErrorMessage(err))
|
||||
},
|
||||
onSuccess(data) {
|
||||
Queries.invitations.list().invalidate()
|
||||
toast("🎉 New invitation generated, invite code is copied")
|
||||
navigator.clipboard.writeText(data.data)
|
||||
dismiss()
|
||||
},
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex items-center">
|
||||
<span>Generating an invitation code will cost you 10 </span><i className="i-mgc-power mx-1 text-base" /><span>Power. Do you want to continue?</span>
|
||||
</div>
|
||||
<div className="mt-4 flex items-center justify-end gap-3">
|
||||
<Button variant="outline" onClick={dismiss}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
isLoading={newInvitation.isPending}
|
||||
onClick={() => newInvitation.mutate()}
|
||||
>
|
||||
Continue
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ export const TransactionsSection = () => {
|
|||
<TableHead className="pl-6" size="sm">
|
||||
Date
|
||||
</TableHead>
|
||||
<TableHead className="pl-6" size="sm">
|
||||
Tx
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
|
|
@ -89,6 +92,9 @@ export const TransactionsSection = () => {
|
|||
<TableCell align="left" size="sm" className="pl-6">
|
||||
<RelativeTime date={row.createdAt} />
|
||||
</TableCell>
|
||||
<TableCell align="left" size="sm" className="pl-6">
|
||||
<a target="_blank" href={`https://scan.rss3.io/tx/${row.hash}`}>{row.hash.slice(0, 6)}...</a>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
|
|
@ -111,11 +117,12 @@ const TypeRenderer = ({
|
|||
>[number]["type"]
|
||||
}) => (
|
||||
<div
|
||||
className={cn("center rounded-full p-px text-xs uppercase", {
|
||||
className={cn("center rounded-full px-1.5 py-px text-xs", {
|
||||
"bg-theme-accent-700 text-white": type === "tip",
|
||||
"bg-green-700 text-white": type === "mint",
|
||||
"bg-red-700 text-white": type === "burn",
|
||||
"bg-yellow-700 text-white": type === "withdraw",
|
||||
"bg-blue-700 text-white": type === "purchase",
|
||||
})}
|
||||
>
|
||||
{type}
|
||||
|
|
|
|||
Loading…
Reference in New Issue