Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/carousel/variants/carousel-top-titles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function CarouselTopTitles({ posts, category }: Readonly<Carousel
>
<Carousel ref={carousel.carouselRef} {...carousel.carouselSettings}>
{posts.map((post: Post) => (
<Box key={`${category}-${post.id}`} sx={{ px: 0.75, height: '100%' }}>
<Box key={`${category}-${post.id}`} sx={{ height: '100%' }}>
<PosterTopTitles post={post} />
</Box>
))}
Expand Down
29 changes: 23 additions & 6 deletions src/hooks/use-account-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const useAccountSession = (): UseAccountSessionHook => {
const [loginInProgress, setLoginInProgress] = useState(false);
const [verifyingUser, setVerifyingUser] = useState(false);
const [userChecked, setUserChecked] = useState(false);
const [initializing, setInitializing] = useState(!restoreDone);
const [initializing, setInitializing] = useState(true);

const sessionRef = useRef(session);
const lastVerifiedRef = useRef<Address | null>(null);
Expand Down Expand Up @@ -158,23 +158,40 @@ export const useAccountSession = (): UseAccountSessionHook => {
}
} catch {
await logout();
} finally {
setUserChecked(true);
setInitializing(false);
}
})();
}, [logout]);

const handleConnected = async () => {
try {
await syncAddress();
} finally {
handleReady();
}
};

const handleReady = () => {
setUserChecked(true);
setInitializing(false);
};

const verifyStatus = () => {
if (web3Auth.status === 'connected' || web3Auth.status === 'ready') handleReady();
};

useEffect(() => {
if (!web3Auth || listenerAttached) return;
listenerAttached = true;
verifyStatus();

web3Auth.on(ADAPTER_EVENTS.DISCONNECTED, logout);
web3Auth.on(ADAPTER_EVENTS.CONNECTED, syncAddress);
web3Auth.on(ADAPTER_EVENTS.CONNECTED, handleConnected);
web3Auth.on(ADAPTER_EVENTS.READY, handleReady);

return () => {
web3Auth.off(ADAPTER_EVENTS.DISCONNECTED, logout);
web3Auth.off(ADAPTER_EVENTS.CONNECTED, syncAddress);
web3Auth.off(ADAPTER_EVENTS.CONNECTED, handleConnected);
web3Auth.off(ADAPTER_EVENTS.READY, handleReady);
listenerAttached = false;
};
}, [web3Auth, logout]);
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/_common/account-popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export function AccountPopover() {
const router = useRouter();
const popover = usePopover();
const { isLoginModalOpen, isAuthLoading } = useAuth();
const { initializing } = useAccountSession();
const { initializing, loading: sessionLoading } = useAccountSession();

if (isAuthLoading) {
return <CircularProgress size={24} sx={{ color: '#fff' }} />;
}

if (initializing) {
if (initializing || sessionLoading) {
return (
<Skeleton
variant="rounded"
Expand Down
2 changes: 0 additions & 2 deletions src/pages/ownership.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export default function FileManagerPage() {
) : (
<BlankView>
<ComingSoonView
deadline={'03/30/2025 21:30'}
showDeadline={true}
content={
"The Ownership is evolving! Soon, you'll gManage digital rights, track licensing, and unlock the power of decentralized ownership. Stay tuned!"
}
Expand Down
2 changes: 0 additions & 2 deletions src/pages/studio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export default function OverviewFilePage() {
>
<BlankView>
<ComingSoonView
deadline={'03/30/2025 21:30'}
showDeadline={true}
content={
"The Studio is evolving! Soon, you'll generate new content and enhance your creations with AI-driven tools for metadata, images, subtitles, voiceovers, and security checks. Stay tuned!"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const ExploreTopPublicationsSkeleton: React.FC = () => {
variant="rectangular"
width={'100%'}
height={'100%'}
sx={{ mb: 1, mx: 0.5, mt: 2, borderRadius: 1 }}
sx={{ mb: 1 }}
/>
<Box
sx={{
Expand Down
10 changes: 2 additions & 8 deletions src/sections/publication/views/publication-details-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export default function PublicationDetailsView({ id }: Readonly<PublicationDetai
const { campaign, loading: campaignLoading, fetchSubscriptionCampaign } = useGetSubscriptionCampaign();
const { isActive: isCampaignActive, loading: isActiveLoading, fetchIsActive } = useGetCampaignIsActive();
const [loadPublications, { data: profilePublications, loading: profilePublicationsLoading }] = useGetPostsByAuthorLazyQuery();
const [initialized, setInitialized] = useState(false);

const isAccessFullyChecked = !accessLoading && !isAuthorizedLoading && !isActiveLoading && !campaignLoading;
const allLoaded = !publicationLoading && !isAuthLoading && !profilePublicationsLoading && isAccessFullyChecked;
const isSponsoredButtonVisible = isCampaignActive && isAuthorized && isAccessFullyChecked;
const isJoinButtonVisible = isAuthorized && !isCampaignActive && isAccessFullyChecked && !isSponsoredButtonVisible;
const isPlayerVisible = hasAccess && session.authenticated && !accessLoading && !isAuthLoading;
const loading = !initialized || (initialized && !publication);
const accessChecked = hasAccess !== undefined;
const loading = (!(allLoaded && accessChecked) && !isAuthLoading) || !publication;

useEffect(() => {
if (!ownerAddress || publicationLoading || profilePublications?.getPostsByAuthor) return;
Expand All @@ -77,12 +77,6 @@ export default function PublicationDetailsView({ id }: Readonly<PublicationDetai
loadPublication({variables: { getPostId: id }});
}, [id, publication]);

useEffect(() => {
if (allLoaded && !initialized) {
setInitialized(true);
}
}, [allLoaded, initialized]);

const handleSubscribe = () => {
if (!session.authenticated) {
dispatch(openLoginModal());
Expand Down
Loading