diff --git a/app/main.wasp b/app/main.wasp
index d2f3c37..1c55f03 100644
--- a/app/main.wasp
+++ b/app/main.wasp
@@ -31,7 +31,7 @@ app OpenSaaS {
},
},
onAuthFailedRedirectTo: "/login",
- onAuthSucceededRedirectTo: "/",
+ onAuthSucceededRedirectTo: "/chat",
},
db: {
system: PostgreSQL,
diff --git a/app/src/client/App.tsx b/app/src/client/App.tsx
index d961a65..546e916 100644
--- a/app/src/client/App.tsx
+++ b/app/src/client/App.tsx
@@ -108,7 +108,24 @@ export default function App({ children }: { children: ReactNode }) {
>
) : (
- children
+ <>
+ {isAdminDashboard ? (
+ children
+ ) : (
+
+ {shouldDisplayAppNavBar &&
}
+ {children}
+
+
+
+
+ © 2024 airt. All rights reserved.
+
+
+
+
+ )}
+ >
)}
>
) : (
diff --git a/app/src/client/app/AccountPage.tsx b/app/src/client/app/AccountPage.tsx
index bec1673..7f23888 100644
--- a/app/src/client/app/AccountPage.tsx
+++ b/app/src/client/app/AccountPage.tsx
@@ -5,6 +5,7 @@ import { STRIPE_CUSTOMER_PORTAL_LINK } from '../../shared/constants';
import { TierIds } from '../../shared/constants';
import Button from '../components/Button';
import FreeTrialButton from '../components/FreeTrialButton';
+import { MarketingEmailPreferenceSwitcher } from '../components/MarketingEmailPreferenceSwitcher';
export default function AccountPage({ user }: { user: User }) {
return (
@@ -63,10 +64,12 @@ export default function AccountPage({ user }: { user: User }) {
)}
-
About
-
- I'm a cool customer.
-
+ I agree to receiving marketing emails
+ <>
+
+ >
diff --git a/app/src/client/auth/Auth.tsx b/app/src/client/auth/Auth.tsx
index a7ec8c3..6ed8365 100644
--- a/app/src/client/auth/Auth.tsx
+++ b/app/src/client/auth/Auth.tsx
@@ -27,7 +27,7 @@ export const MessageSuccess = styled(Message, {
});
const logoStyle = {
- height: '6rem',
+ height: '3rem',
};
const Container = styled('div', {
@@ -75,24 +75,14 @@ function Auth({
// const title = titles[state];
- const socialButtonsDirection =
- socialLayout === 'vertical' ? 'vertical' : 'horizontal';
+ const socialButtonsDirection = socialLayout === 'vertical' ? 'vertical' : 'horizontal';
return (
- {logo && (
-
- )}
+ {logo &&
}
{/*
{title} */}
-
- {state === 'signup' ? titles.signup : titles.login}
-
+
{state === 'signup' ? titles.signup : titles.login}
{/* {errorMessage && (
@@ -103,9 +93,7 @@ function Auth({
)} */}
{successMessage &&
{successMessage}}
-
+
{(state === 'login' || state === 'signup') && (
{
- const { isLoading, setErrorMessage, setSuccessMessage, setIsLoading } =
- useContext(AuthContext);
+ const { isLoading, setErrorMessage, setSuccessMessage, setIsLoading } = useContext(AuthContext);
const [tocChecked, setTocChecked] = useState(false);
const [marketingEmailsChecked, setMarketingEmailsChecked] = useState(false);
const [loginFlow, setLoginFlow] = useState(state);
@@ -87,9 +85,7 @@ export const LoginSignupForm = ({
setTocChecked(event.target.checked);
};
- const handleMarketingEmailsChange = (
- event: React.ChangeEvent
- ) => {
+ const handleMarketingEmailsChange = (event: React.ChangeEvent) => {
setMarketingEmailsChecked(event.target.checked);
};
@@ -97,16 +93,10 @@ export const LoginSignupForm = ({
localStorage.removeItem('hasAcceptedTos');
localStorage.removeItem('hasSubscribedToMarketingEmails');
localStorage.setItem('hasAcceptedTos', JSON.stringify(tocChecked));
- localStorage.setItem(
- 'hasSubscribedToMarketingEmails',
- JSON.stringify(marketingEmailsChecked)
- );
+ localStorage.setItem('hasSubscribedToMarketingEmails', JSON.stringify(marketingEmailsChecked));
};
- const handleClick = (
- event: React.MouseEvent,
- googleSignInUrl: string
- ) => {
+ const handleClick = (event: React.MouseEvent, googleSignInUrl: string) => {
event.preventDefault();
if (loginFlow === State.Login) {
updateLocalStorage();
@@ -121,8 +111,7 @@ export const LoginSignupForm = ({
}
};
- const googleBtnText =
- loginFlow === State.Login ? 'Sign in with Google' : 'Sign up with Google';
+ const googleBtnText = loginFlow === State.Login ? 'Sign in with Google' : 'Sign up with Google';
return (
<>
@@ -139,9 +128,7 @@ export const LoginSignupForm = ({
@@ -182,12 +167,10 @@ export const LoginSignupForm = ({
- {loginFlow === State.Login
- ? "Don't have an account? "
- : 'Already have an account? '}
+ {loginFlow === State.Login ? "Don't have an account? " : 'Already have an account? '}
{loginFlow === State.Login ? 'Sign up' : 'Sign in'}
diff --git a/app/src/client/components/AnimatedCharacterLoader.tsx b/app/src/client/components/AnimatedCharacterLoader.tsx
index d8d3659..93c5e7f 100644
--- a/app/src/client/components/AnimatedCharacterLoader.tsx
+++ b/app/src/client/components/AnimatedCharacterLoader.tsx
@@ -33,7 +33,7 @@ const AnimatedCharacterLoader: React.FC = ({
>
{showLogo && (
(null);
+
+ const handleChange = (e: React.ChangeEvent) => {
+ setStatus(e.target.value === 'Yes');
+ setHasChanged(true);
+ };
+
+ const onClick = () => {
+ setNotificationType(null);
+ };
+
+ const handleClick = async (status: boolean) => {
+ try {
+ await updateCurrentUser({ hasSubscribedToMarketingEmails: status });
+ setNotificationType('success');
+ } catch (e) {
+ setNotificationType('error');
+ }
+ setHasChanged(false);
+ };
+
+ const notificationMsg =
+ notificationType === 'success'
+ ? 'Your changes are saved successfully.'
+ : 'Something went wrong. Please try again later.';
+
+ return (
+ <>
+ {notificationType && (
+
+ )}
+
+
+
+
+
+
+
+
+ >
+ );
+}
diff --git a/app/src/client/components/NotificationBox.tsx b/app/src/client/components/NotificationBox.tsx
new file mode 100644
index 0000000..bcc71b4
--- /dev/null
+++ b/app/src/client/components/NotificationBox.tsx
@@ -0,0 +1,32 @@
+import React from 'react';
+
+interface NotificationBoxProps {
+ type: 'success' | 'error';
+ message: string;
+ onClick: () => void;
+}
+
+const NotificationBox: React.FC = ({ type, message, onClick }) => {
+ const isSuccess = type === 'success';
+
+ return (
+
+
+
{isSuccess ? 'Success' : 'Error'}
+
{message}
+
+
+
+
+
+ );
+};
+
+export default NotificationBox;
diff --git a/app/src/client/components/TosAndMarketingEmails.tsx b/app/src/client/components/TosAndMarketingEmails.tsx
index 7ade8aa..df549b2 100644
--- a/app/src/client/components/TosAndMarketingEmails.tsx
+++ b/app/src/client/components/TosAndMarketingEmails.tsx
@@ -30,39 +30,23 @@ const TosAndMarketingEmails: React.FC = ({
handleMarketingEmailsChange,
errorMessage,
}) => (
-
+
-