Skip to content

Commit a05ee82

Browse files
authored
Merge pull request #1033 from trycompai/mariano/comp-229-dub-affiliates
[dev] [Marfuen] mariano/comp-229-dub-affiliates
2 parents 1455f33 + 2b66735 commit a05ee82

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

apps/app/src/app/(app)/[orgId]/referrals/components/DubReferral.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
'use client';
22

3+
import { Skeleton } from '@comp/ui/skeleton';
34
import { DubEmbed } from '@dub/embed-react';
5+
import { useTheme } from 'next-themes';
46
import { useEffect, useState } from 'react';
57

68
export const DubReferral = () => {
79
const [publicToken, setPublicToken] = useState('');
810
const [error, setError] = useState<string | null>(null);
911
const [isLoading, setIsLoading] = useState(true);
12+
const { theme } = useTheme();
1013

1114
useEffect(() => {
1215
const fetchPublicToken = async () => {
@@ -39,7 +42,11 @@ export const DubReferral = () => {
3942
}, []);
4043

4144
if (isLoading) {
42-
return <div>Loading...</div>;
45+
return (
46+
<div className="flex items-center justify-center">
47+
<Skeleton className="h-[100vh] w-full max-w-[1024px] rounded-none" />
48+
</div>
49+
);
4350
}
4451

4552
if (error) {
@@ -75,5 +82,15 @@ export const DubReferral = () => {
7582
);
7683
}
7784

78-
return <DubEmbed data="referrals" token={publicToken} />;
85+
const dubTheme = theme === 'dark' ? 'dark' : 'light';
86+
87+
return (
88+
<DubEmbed
89+
data="referrals"
90+
token={publicToken}
91+
options={{
92+
theme: dubTheme,
93+
}}
94+
/>
95+
);
7996
};

0 commit comments

Comments
 (0)