- //
+
);
});
diff --git a/src/app/(main)/home/service.ts b/src/app/(main)/home/service.ts
deleted file mode 100644
index e69de29..0000000
diff --git a/src/app/(main)/home/type.d.ts b/src/app/(main)/home/type.d.ts
deleted file mode 100644
index e69de29..0000000
diff --git a/src/components/ui/gradient-divider.tsx b/src/components/ui/gradient-divider.tsx
index a0c159d..cf9144c 100644
--- a/src/components/ui/gradient-divider.tsx
+++ b/src/components/ui/gradient-divider.tsx
@@ -1,36 +1,11 @@
-'use client'
+'use client';
-import React from 'react'
-import { cn } from '@/lib/utils'
+import { cn } from '@/lib/utils';
-interface GradientDividerProps {
- className?: string
-}
-
-export function GradientDivider({ className }: GradientDividerProps) {
+export function GradientDivider() {
return (
-
+
- )
- return (
-
- )
+ );
}
diff --git a/src/css/tailwindcss.css b/src/css/tailwindcss.css
index c4200b2..c1de7d5 100644
--- a/src/css/tailwindcss.css
+++ b/src/css/tailwindcss.css
@@ -651,6 +651,13 @@
line-height: var(--glo-font-lineheight-size16);
}
+@utility txt-title-xs {
+ font-family: var(--font-poppins);
+ font-size: var(--glo-font-size-14);
+ font-weight: var(--glo-font-weight-semibold);
+ line-height: var(--glo-font-lineheight-size14);
+}
+
@utility txt-bodySemibold-l {
font-family: var(--font-poppins);
font-size: var(--glo-font-size-16);
diff --git a/src/hooks/services/signin.ts b/src/hooks/services/signin.ts
new file mode 100644
index 0000000..dcd92f0
--- /dev/null
+++ b/src/hooks/services/signin.ts
@@ -0,0 +1,33 @@
+import { getSevenDaysSignList, signIn } from '@/services/editor';
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
+import { useCurrentUser } from '../auth';
+import { toast } from 'sonner';
+import { useTranslations } from 'next-intl';
+
+export function useSignIn() {
+ const { data: user } = useCurrentUser();
+ const t = useTranslations('crushcoin');
+ const queryClient = useQueryClient();
+ const { data: signInListData, isLoading: fetchSignInListLoading } = useQuery({
+ queryKey: ['signInList'],
+ enabled: !!user?.userId,
+ queryFn: () => getSevenDaysSignList({ userId: user?.userId }),
+ });
+
+ const { mutate: handleSignIn, isPending: signInLoading } = useMutation({
+ mutationFn: () => signIn({ userId: user?.userId }),
+ onSuccess: () => {
+ queryClient.invalidateQueries({
+ queryKey: ['signInList'],
+ });
+ toast.success(t('checked_success'));
+ },
+ });
+
+ return {
+ signInListData,
+ fetchSignInListLoading,
+ signInLoading,
+ handleSignIn,
+ };
+}
diff --git a/src/i18n/en-US.ts b/src/i18n/en-US.ts
index b61aca1..866d006 100644
--- a/src/i18n/en-US.ts
+++ b/src/i18n/en-US.ts
@@ -152,6 +152,18 @@ export default {
female: 'Female',
},
},
+ crushcoin: {
+ title: 'Daily Free CrushCoins',
+ consecutiveDays: "You've checked in for {days} consecutive days.",
+ description1: 'Diamonds can be used to pay for chat services and unlock other items.',
+ description2:
+ 'If you miss a check-in, the check-in count will reset and start again from day one.',
+ day: 'Day {day}',
+ checked: 'Checked',
+ notStarted: 'Not Started',
+ loading: 'Signing in...',
+ checked_success: 'Check-in successful',
+ },
footer: {
slogan: "Grow your love story with Spicyxx.AI AI—From 'Hi' to 'I Do', sparked by every chat",
features: 'Features',
diff --git a/src/i18n/zh-CN.ts b/src/i18n/zh-CN.ts
index ee0f19a..8b4426a 100644
--- a/src/i18n/zh-CN.ts
+++ b/src/i18n/zh-CN.ts
@@ -150,6 +150,17 @@ export default {
female: '女性',
},
},
+ crushcoin: {
+ title: '每日免费金币',
+ consecutiveDays: '你已经连续签到 {days} 天',
+ description1: '金币可用于支付聊天服务和解锁其他物品。',
+ description2: '如果错过签到,签到计数将重置并从第一天重新开始。',
+ day: '第 {day} 天',
+ checked: '已签到',
+ notStarted: '未开始',
+ loading: '签到中ing',
+ checked_success: '签到成功',
+ },
footer: {
slogan: '用 Spicyxx.AI 成长你的爱情故事——从"你好"到"我愿意",每一次对话都点燃火花',
features: '功能',
diff --git a/src/layout/BasicLayout/Topbar.tsx b/src/layout/BasicLayout/Topbar.tsx
index 32fe44a..e6116e8 100644
--- a/src/layout/BasicLayout/Topbar.tsx
+++ b/src/layout/BasicLayout/Topbar.tsx
@@ -114,9 +114,12 @@ function Topbar() {
return (
{shouldBlur && }
diff --git a/src/layout/BasicLayout/config.ts b/src/layout/BasicLayout/config.ts
index 2aacadd..505e2f1 100644
--- a/src/layout/BasicLayout/config.ts
+++ b/src/layout/BasicLayout/config.ts
@@ -22,6 +22,7 @@ export const topbarRouteConfigs: Record = {
'/profile/account': { hideOnMobile: true },
'/character/:id': { hideOnMobile: true },
'/chat/:id': { enableBlur: true },
+ '/crushcoin': { hideOnMobile: true },
};
/**
diff --git a/src/services/editor/index.ts b/src/services/editor/index.ts
index b48f44a..94f85a1 100644
--- a/src/services/editor/index.ts
+++ b/src/services/editor/index.ts
@@ -1,5 +1,5 @@
import { editorRequest } from '@/lib/client';
-import { LikeObjectParamsType } from './type';
+import { LikeObjectParamsType, SignInListType } from './type';
export async function fetchCharacters({ index, limit, query }: any) {
const { data } = await editorRequest('/api/character/list', {
@@ -25,3 +25,12 @@ export async function thmubObject(params: LikeObjectParamsType) {
export async function getLikeStatus(params: Pick) {
return editorRequest('/api/like/getLikeStatus', { method: 'POST', data: params });
}
+
+export async function getSevenDaysSignList(params: any = {}): Promise {
+ const { data } = await editorRequest('/api/sign/list', { method: 'POST', data: params });
+ return data;
+}
+
+export async function signIn(params: any = {}) {
+ return editorRequest('/api/sign/asi', { method: 'POST', data: params });
+}
diff --git a/src/services/editor/type.ts b/src/services/editor/type.ts
index 87e8545..d39c0bc 100644
--- a/src/services/editor/type.ts
+++ b/src/services/editor/type.ts
@@ -22,6 +22,7 @@ export type CharacterType = {
[x: string]: any;
};
+// 点赞点踩
export enum LikeTargetType {
Character = 0,
Story = 1,
@@ -36,3 +37,13 @@ export type LikeObjectParamsType = {
userId?: number;
likeType?: LikeType;
};
+
+// 签到
+export type SignInListType = {
+ continuousDays: number;
+ list: {
+ coinNum: number;
+ dayStr: string;
+ signIn: boolean;
+ }[];
+};