Toast message on leaving team

pull/4259/head
Kamran Ahmed 1 year ago
parent 94ad20fc04
commit 8787ed46c5
  1. 2
      src/components/TeamMembers/LeaveTeamPopup.tsx
  2. 14
      src/components/Toast.tsx
  3. 2
      src/layouts/BaseLayout.astro

@ -45,7 +45,7 @@ export function LeaveTeamPopup(props: LeaveTeamPopupProps) {
return; return;
} }
window.location.href = '/account'; window.location.href = '/account?c=tl';
}; };
const handleClosePopup = () => { const handleClosePopup = () => {

@ -6,12 +6,26 @@ import { ErrorIcon } from './ReactIcons/ErrorIcon';
import { WarningIcon } from './ReactIcons/WarningIcon'; import { WarningIcon } from './ReactIcons/WarningIcon';
import { InfoIcon } from './ReactIcons/InfoIcon'; import { InfoIcon } from './ReactIcons/InfoIcon';
import { Spinner } from './ReactIcons/Spinner'; import { Spinner } from './ReactIcons/Spinner';
import { deleteUrlParam, getUrlParams, setUrlParams } from '../lib/browser';
export interface Props {} export interface Props {}
const messageCodes: Record<string, string> = {
tl: 'Successfully left the team',
};
export function Toaster(props: Props) { export function Toaster(props: Props) {
const toastMessage = useStore($toastMessage); const toastMessage = useStore($toastMessage);
const { c } = getUrlParams();
if (c) {
deleteUrlParam('c');
if (messageCodes[c]) {
$toastMessage.set({ type: 'success', message: messageCodes[c] });
}
}
useEffect(() => { useEffect(() => {
if (toastMessage === undefined) { if (toastMessage === undefined) {
return; return;

@ -156,7 +156,7 @@ const gaPageIdentifier = Astro.url.pathname
<slot name="login-popup"> <slot name="login-popup">
<LoginPopup /> <LoginPopup />
</slot> </slot>
<Toaster client:idle /> <Toaster client:only />
<CommandMenu client:idle /> <CommandMenu client:idle />
<PageProgress initialMessage={initialLoadingMessage} client:idle /> <PageProgress initialMessage={initialLoadingMessage} client:idle />
<PageSponsor <PageSponsor

Loading…
Cancel
Save