Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: About Us #441

Merged
merged 7 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 20 additions & 1 deletion packages/frontend/src/api/store/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "../types";
import { Logger } from "../utils/logging";
import { RootState } from "./reducer";
import { IUIState } from "./slices/ui";
import { IViewsState } from "./slices/views";

type PersistedRootState = (PersistedState & RootState) | undefined;
Expand All @@ -37,7 +38,14 @@ type PersistedRootState = (PersistedState & RootState) | undefined;
* 102: (s: RootStateV101) => PersistedRootState
*/

type RootStateV105 = PersistedRootState;
type RootStateV106 = PersistedRootState;

type RootStateV105 =
| (PersistedState &
Omit<RootState, "ui"> & {
ui: Omit<IUIState, "showAboutModal">;
})
| undefined;

type RootStateV104 =
| (PersistedState & Omit<RootState, "userFilters">)
Expand Down Expand Up @@ -102,6 +110,7 @@ type TMigrations = MigrationManifest & {
103: (s: RootStateV102) => RootStateV103;
104: (s: RootStateV103) => RootStateV104;
105: (s: RootStateV104) => RootStateV105;
106: (s: RootStateV105) => RootStateV106;
};

/**
Expand Down Expand Up @@ -261,6 +270,16 @@ const migrations: TMigrations = {
},
};
},
106: (s: RootStateV105): RootStateV106 => {
if (!s) return undefined;
return {
...s,
ui: {
...s.ui,
showAboutModal: false,
},
};
},
};

export default migrations;
6 changes: 6 additions & 0 deletions packages/frontend/src/api/store/slices/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface IUIState {
theme: TTheme;
showWidgetLib: boolean;
showBalance: boolean;
showAboutModal: boolean;
tutorial: ITutorialState;
cookieChoice: ECookieChoice | undefined;
mobile: {
Expand All @@ -24,6 +25,7 @@ export interface IUIState {
const initialState: IUIState = {
theme: "dark",
showWidgetLib: false,
showAboutModal: false,
showBalance: true,
tutorial: { showTutorial: undefined, currentTutorialTip: undefined },
cookieChoice: undefined,
Expand Down Expand Up @@ -53,6 +55,9 @@ const uiSlice = createSlice({
toggleShowBalance(draft) {
draft.showBalance = !draft.showBalance;
},
toggleAboutModal(draft) {
draft.showAboutModal = !draft.showAboutModal;
},
toggleWidgetsNavOpen(draft) {
draft.mobile.widgetsNavOpen = !draft.mobile.widgetsNavOpen;
},
Expand Down Expand Up @@ -99,6 +104,7 @@ export const {
toggleTheme,
toggleShowWidgetLib,
toggleShowBalance,
toggleAboutModal,
toggleWidgetsNavOpen,
setStoreShowTutorial,
setCurrentTutorialTip,
Expand Down
111 changes: 111 additions & 0 deletions packages/frontend/src/components/AboutUsModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import {
Button,
Modal,
ModalBody,
ModalFooter,
ModalHeader,
ModalTitle,
} from "@alphaday/ui-kit";

interface IProps {
showModal: boolean;
onClose?: () => void;
}
export const AboutUsModal: React.FC<IProps> = ({ showModal, onClose }) => {
return (
<Modal showModal={showModal} onClose={onClose}>
v-almonacid marked this conversation as resolved.
Show resolved Hide resolved
<ModalHeader className="">
elcharitas marked this conversation as resolved.
Show resolved Hide resolved
<ModalTitle>About Us</ModalTitle>
</ModalHeader>

<ModalBody className="[&_a]:text-secondaryOrange">
<h6>Company Overview:</h6>
<p>
Registered Name: Alphabox Solutions Pte. Ltd.
<br />
Registration Number: <code>202136261C</code>
<br />
Registered Office: 45 North Canal Road #01-01 Lew Building
Singapore
</p>

<h6>Contact Information:</h6>
<p>
Email Address:{" "}
<a href="mailto:hello@alphaday.com">hello@alphaday.com</a>
<br />
X.com:{" "}
<a
href="https://x.com/AlphadayHQ"
target="_blank"
rel="noreferrer"
>
https://x.com/AlphadayHQ
</a>
</p>

<h6>Legal Information:</h6>
<p>
Terms & Conditions:{" "}
<a
href="https://alphaday.com/terms"
target="_blank"
rel="noreferrer"
>
https://alphaday.com/terms
</a>
<br />
Privacy Policy:{" "}
<a
href="https://alphaday.com/privacy"
target="_blank"
rel="noreferrer"
>
https://alphaday.com/privacy
</a>
</p>

<h6>Additional Resources:</h6>
<p>
FAQs:{" "}
<a
href="https://alphaday.com/"
target="_blank"
rel="noreferrer"
>
alphaday.com
</a>
<br />
API:{" "}
<a
href="http://api.alphaday.com/"
target="_blank"
rel="noreferrer"
v-almonacid marked this conversation as resolved.
Show resolved Hide resolved
>
http://api.alphaday.com/
</a>
<br />
Feedback:{" "}
<a
href="https://forms.gle/RbrrLGdFPAeuNJhk9"
target="_blank"
rel="noreferrer"
>
https://forms.gle/RbrrLGdFPAeuNJhk9
</a>
</p>
<p>
Alphaday&apos;s mission is to bring you all the tools needed
to follow your favorite projects, stay up-to-date with the
latest narratives, and use your favorite dapps, all from the
comfort of one easy-to-use customizable dashboard.
</p>
</ModalBody>
<ModalFooter>
<Button className="pt-1.5" onClick={onClose}>
Close
</Button>
</ModalFooter>
</Modal>
);
};
2 changes: 1 addition & 1 deletion packages/frontend/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const CONFIG = {
APP: {
VERSION: import.meta.env.VITE_VERSION || "",
STORAGE_KEY: "alphaday",
STORAGE_VERSION: 105,
STORAGE_VERSION: 106,
COMMIT: import.meta.env.VITE_COMMIT,
COMMIT_TIMESTAMP: import.meta.env.VITE_COMMIT_TS || "",
X_APP_ID: import.meta.env.VITE_X_APP_ID || "",
Expand Down
17 changes: 17 additions & 0 deletions packages/frontend/src/containers/AboutUsModalContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { toggleAboutModal } from "src/api/store";
import { useAppDispatch, useAppSelector } from "src/api/store/hooks";
import { AboutUsModal } from "src/components/AboutUsModal";

export const AboutUsModalContainer = () => {
const dispatch = useAppDispatch();
const showModal = useAppSelector((state) => state.ui.showAboutModal);
const toggleModal = () => dispatch(toggleAboutModal());

const onClose = () => {
if (showModal) {
toggleModal();
elcharitas marked this conversation as resolved.
Show resolved Hide resolved
}
};

return <AboutUsModal showModal={showModal} onClose={onClose} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import { FC } from "react";
import { useAccount } from "src/api/hooks";
import { useAuth } from "src/api/hooks/useAuth";
import { useTutorial } from "src/api/hooks/useTutorial";
import { toggleAboutModal } from "src/api/store";
import { useAppDispatch } from "src/api/store/hooks";
import { ETutorialTipId } from "src/api/types";
import ProfileDropdownWrapper from "./ProfileDropdownWrapper";

const ProfileDropdownContainer: FC = () => {
const dispatch = useAppDispatch();
const { openAuthModal, isAuthenticated, logout } = useAuth();
const { userProfile } = useAccount();
const {
Expand All @@ -15,12 +18,15 @@ const ProfileDropdownContainer: FC = () => {
setTutFocusElemRef,
} = useTutorial();

const toggleAboutUsModal = () => dispatch(toggleAboutModal());

return (
<ProfileDropdownWrapper
onSignOut={logout}
onSignUpSignIn={openAuthModal}
isAuthenticated={isAuthenticated}
onShowTutorial={toggleShowTutorial}
onShowAboutUsModal={toggleAboutUsModal}
showTutorial={showTutorial}
setTutFocusElemRef={
currentTutorial.tip?.id === ETutorialTipId.ComeBack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface IProps {
isAuthenticated: boolean;
onShowTutorial: (s: boolean) => void;
showTutorial: boolean | undefined;
onShowAboutUsModal: () => void;
setTutFocusElemRef?:
| React.Dispatch<React.SetStateAction<HTMLElement | null>>
| undefined;
Expand All @@ -36,14 +37,15 @@ const ProfileDropdownWrapper: React.FC<IProps> = ({
onSignUpSignIn,
onShowTutorial,
showTutorial,
onShowAboutUsModal,
isAuthenticated,
setTutFocusElemRef,
profile,
}) => {
const [toggleState, setToggleState] = useState(false);
const [toggleTutorialState, setToggleTutorialState] = useState(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some unrelated renaming


const handleToggle = () => {
setToggleState((prev) => !prev);
setToggleTutorialState((prev) => !prev);
setTimeout(() => {
onShowTutorial(true);
}, 500);
Expand All @@ -64,7 +66,7 @@ const ProfileDropdownWrapper: React.FC<IProps> = ({
};

useEffect(() => {
if (!showTutorial) setToggleState(false);
if (!showTutorial) setToggleTutorialState(false);
}, [showTutorial]);

return (
Expand Down Expand Up @@ -123,10 +125,16 @@ const ProfileDropdownWrapper: React.FC<IProps> = ({
type="checkbox"
className={styles.toggle}
onChange={handleToggle}
checked={toggleState}
checked={toggleTutorialState}
/>
</DropdownItem>
<Divider />
<DropdownItem onClick={onShowAboutUsModal}>
<span title="Lear more about Alphaday">
About Us
</span>
</DropdownItem>
<Divider />
{CONFIG.APP.VERSION && CONFIG.APP.COMMIT && (
<DropdownItem className="hover:bg-background pb-0 pt-5">
<div className="fontGroup-mini w-full">
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import { Logger } from "src/api/utils/logging";
import { EToastRole, toast } from "src/api/utils/toastUtils";
import CONFIG from "src/config/config";
import { AboutUsModalContainer } from "src/containers/AboutUsModalContainer";
import ModuleWrapper from "src/containers/base/ModuleWrapper";
import CookieDisclaimerContainer from "src/containers/cookie-disclaimer/CookieDisclaimerContainer";
import AuthContainer from "src/containers/dialogs/AuthContainer";
Expand Down Expand Up @@ -357,6 +358,7 @@ function BasePage({ isFullsize }: { isFullsize: boolean | undefined }) {
<AuthContainer />
<TutorialContainer />
<WalletConnectionDialogContainer />
<AboutUsModalContainer />
</MainLayout>
);
}
Expand Down
12 changes: 11 additions & 1 deletion packages/ui-kit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ import {
} from "./src/components/listItem/ListItem";
import { ErrorModal } from "./src/components/modal/ErrorModal";
import { FullPageModal } from "./src/components/modal/FullPageModal";
import { Modal } from "./src/components/modal/Modal";
import {
Modal,
ModalHeader,
ModalBody,
ModalTitle,
ModalFooter,
} from "./src/components/modal/Modal";
import { ModulePreview } from "./src/components/module-preview/ModulePreview";
import { ModuleLoader } from "./src/components/moduleLoader/ModuleLoader";
import { Overlay } from "./src/components/overlay/Overlay";
Expand Down Expand Up @@ -143,6 +149,10 @@ export {
Dialog,
TextOverlay,
Modal,
ModalHeader,
ModalBody,
ModalTitle,
ModalFooter,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we forgot to export these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because Modals were placed here packages/ui-kit/src/components/modal
Screenshot 2024-08-08 at 21 33 46

Input,
ModuleLoader,
ListItem,
Expand Down
Loading