|
@@ -18,12 +18,13 @@ export interface SignInModalProps {
|
|
|
interface BoxParams {
|
|
|
startDays?: number;
|
|
|
type?: "page" | "modal";
|
|
|
+ onClaim: () => void;
|
|
|
}
|
|
|
interface BoxList {
|
|
|
handleOpening: (index: number) => void;
|
|
|
}
|
|
|
export const BoxListCom = forwardRef<BoxList, BoxParams>(function BoxListCom(
|
|
|
- { startDays = 1, type = "modal" }: BoxParams,
|
|
|
+ { startDays = 1, type = "modal", onClaim }: BoxParams,
|
|
|
ref
|
|
|
) {
|
|
|
const signData = useSignStore((state) => state.signData);
|
|
@@ -39,13 +40,29 @@ export const BoxListCom = forwardRef<BoxList, BoxParams>(function BoxListCom(
|
|
|
handleOpening,
|
|
|
};
|
|
|
});
|
|
|
+
|
|
|
+ const doClick = (item: any, idx: number) => {
|
|
|
+ if (
|
|
|
+ !item.is_suss &&
|
|
|
+ signData.cur_num === idx &&
|
|
|
+ signData.is_op &&
|
|
|
+ typeof onClaim === "function"
|
|
|
+ ) {
|
|
|
+ onClaim();
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<div className={`w-[100%] ${type === "page" ? styles.page : styles.modal}`}>
|
|
|
<div className="flex h-[100%] w-[100%] flex-wrap justify-start">
|
|
|
{signData?.list?.map((item, index) => {
|
|
|
return (
|
|
|
- <div className="h-[100%] w-[20%]" key={index}>
|
|
|
+ <div
|
|
|
+ className="h-[100%] w-[20%]"
|
|
|
+ key={index}
|
|
|
+ onClick={() => doClick(item, index)}
|
|
|
+ >
|
|
|
<div className="h-[100%] w-[100%]">
|
|
|
<div
|
|
|
className={`relative text-center ${styles.text} text-[white]`}
|
|
@@ -321,7 +338,7 @@ const SignInModal = forwardRef(function SignInModal(props: SignInModalProps1, re
|
|
|
<div className="absolute left-0 top-0 w-[100%]">
|
|
|
<div className="relative mt-[0.51rem] w-[100%]">
|
|
|
<div className="max-h-[3rem] overflow-auto">
|
|
|
- <BoxListCom ref={boxRef} />
|
|
|
+ <BoxListCom ref={boxRef} onClaim={doClaim} />
|
|
|
</div>
|
|
|
|
|
|
<div
|