Skip to content

Commit

Permalink
Merge pull request #2676 from decentdao/handicap-netlify
Browse files Browse the repository at this point in the history
Handicap netlify
  • Loading branch information
adamgall authored Jan 16, 2025
2 parents d2d4d4a + ecac3e0 commit 56ad071
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions src/components/ui/page/Global/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as amplitude from '@amplitude/analytics-browser';
import { Box } from '@chakra-ui/react';
import * as Sentry from '@sentry/react';
import { useEffect, useState } from 'react';
import { toast } from 'sonner';
import { useAccount } from 'wagmi';
import { isFeatureEnabled } from '../../../../helpers/featureFlags';
import { useAccountFavorites } from '../../../../hooks/DAO/loaders/useFavorites';
import {
CacheExpiry,
Expand Down Expand Up @@ -89,12 +92,63 @@ const useUpdateFavoritesCache = (onFavoritesUpdated: () => void) => {
}, [favoritesList, onFavoritesUpdated]);
};

function Leave() {
return (
<Box lineHeight="1rem">
<Box fontWeight="bold">This domain is shutting down on 2025-01-19.</Box>
<Box mt="0.25rem">
<Box>Please use:</Box>
<Box>
<a
target="_blank"
rel="noreferrer"
href="https://develop.decent-interface.pages.dev"
>
https://develop.decent-interface.pages.dev
</a>
</Box>
</Box>
<Box mt="0.25rem">
<Box>Learn how to migrate your local &quot;My DAOs&quot; to the new domain:</Box>
<Box>
<a
target="_blank"
rel="noreferrer"
href="https://youtu.be/xvPrWmsBlBc"
>
https://youtu.be/xvPrWmsBlBc
</a>
</Box>
</Box>
</Box>
);
}

const useLeave = () => {
useEffect(() => {
if (!isFeatureEnabled('flag_leave')) {
return;
}
const leaveToast = toast.error(<Leave />, {
dismissible: false,
duration: Infinity,
closeButton: false,
});
return () => {
toast.dismiss(leaveToast);
};
}, []);
};

export function Global() {
useUserTracking();

// Initialize all modes from URL parameters
useInitializeDemoMode();

// Can remove this after about 2025-01-19 when we shut down Netlify
useLeave();

// Trigger a re-render when favorite names are updated
const [favoritesUpdatedTrigger, setFavoritesUpdatedTrigger] = useState(0);
useUpdateFavoritesCache(() => setFavoritesUpdatedTrigger(prev => prev + 1));
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const FEATURE_FLAGS = ['flag_dev', 'flag_yelling'] as const;
export const FEATURE_FLAGS = ['flag_dev', 'flag_yelling', 'flag_leave'] as const;

export type FeatureFlagKeys = typeof FEATURE_FLAGS;
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[number];
Expand Down

0 comments on commit 56ad071

Please sign in to comment.