Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
'use client';

import { Skeleton } from '@comp/ui/skeleton';
import { DubEmbed } from '@dub/embed-react';
import { useTheme } from 'next-themes';
import { useEffect, useState } from 'react';

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

useEffect(() => {
const fetchPublicToken = async () => {
Expand Down Expand Up @@ -39,7 +42,11 @@ export const DubReferral = () => {
}, []);

if (isLoading) {
return <div>Loading...</div>;
return (
<div className="flex items-center justify-center">
<Skeleton className="h-[100vh] w-full max-w-[1024px] rounded-none" />
</div>
);
}

if (error) {
Expand Down Expand Up @@ -75,5 +82,15 @@ export const DubReferral = () => {
);
}

return <DubEmbed data="referrals" token={publicToken} />;
const dubTheme = theme === 'dark' ? 'dark' : 'light';

return (
<DubEmbed
data="referrals"
token={publicToken}
options={{
theme: dubTheme,
}}
/>
);
};