Skip to content

Commit

Permalink
Update Referral look and mobile optimizations
Browse files Browse the repository at this point in the history
- Optimize for portrait mode with pure CSS
- Remove JS based mobile optimizations
- Fix cut content on hub
- Move help button slightly right to not overlap
- Further minor optimizations
  • Loading branch information
ronnyhaase committed Oct 21, 2023
1 parent 9c80f20 commit 891cce3
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 346 deletions.
13 changes: 8 additions & 5 deletions packages/app/src/common/container/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type FC, type PropsWithChildren, type ReactNode } from "react";
import clx from "classnames";

interface CardProps {
className?: string;
title?: string;
image?: ReactNode;
orientation?: "horizontal" | "vertical";
Expand All @@ -10,6 +11,7 @@ interface CardProps {

export const Card: FC<PropsWithChildren & CardProps> = ({
children,
className,
image,
title,
orientation = "vertical",
Expand All @@ -19,25 +21,26 @@ export const Card: FC<PropsWithChildren & CardProps> = ({
className={clx(
orientation === "horizontal" && "card-side",
size === "small"
? "w-32 h-32 p-2"
? "w-32 sm:h-32 p-2"
: size === "medium"
? "w-48 h-48 p-4"
? "w-40 sm:w-48 h-40 sm:h-48 p-4"
: "w-128 h-128 p-4",
"card glass"
"card glass",
className
)}
>
{image !== undefined && <figure className="min-h-2/3">{image}</figure>}
<div
className={clx(
"card-body items-center content-center",
size === "small" ? "p-1" : size === "medium" ? "p-1" : "p-3"
size === "small" ? "p-1" : size === "medium" ? "p-1" : "p-0 sm:p-3"
)}
>
{title !== undefined && (
<h2
className={clx(
"card-title text-center",
size === "small" && "text-s"
size === "small" ? "!text-sm" : "!text-sm sm:!text-xl"
)}
>
{title}
Expand Down
50 changes: 0 additions & 50 deletions packages/app/src/common/container/TopicContainer.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/app/src/common/partials/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Layout: FC<{ children: ReactNode }> = ({ children }) => {
</WalletMultiButton>
</Transition>
<Transition
className="z-10 fixed bottom-4 right-8"
className="z-10 fixed bottom-4 right-4"
show={zenMode.showHelpButton}
unmount={false}
enterFrom="opacity-0"
Expand Down
3 changes: 0 additions & 3 deletions packages/app/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ const replaceInArray = <T>(arr: T[], oldItem: T, newItem: T): T[] => {
return [...arr.slice(0, index), newItem, ...arr.slice(index + 1)];
};

const isMobilePortrait = (width: number): boolean => width < 768;

export {
addUp,
round,
Expand All @@ -200,5 +198,4 @@ export {
memoise,
handleError,
noop,
isMobilePortrait,
};
4 changes: 1 addition & 3 deletions packages/app/src/forest/ForestApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { ForestLink } from "./ForestLink";
import { useWallet } from "@solana/wallet-adapter-react";
import { type ParentRelationship, type TreeNode } from "../api/types";
import { LinkWithQuery } from "../common/components/LinkWithQuery";
import { useScreenOrientation } from "../hub/hooks/useScreenOrientation";

const ForestTree: FC<{ details: TreeComponent; style?: CSSProperties }> = ({
details,
Expand Down Expand Up @@ -101,13 +100,12 @@ const _ForestApp: ForwardRefRenderFunction<
> = ({ className, active = false, ...rest }, ref) => {
const [, updateZenMode] = useZenMode();
const { currentHelpRoute } = useHelp();
const { screenType } = useScreenOrientation();
useEffect(() => {
if (currentHelpRoute !== AppRoute.Forest) return; // we are not on the forest page, so don't update zen mode
updateZenMode((prev) => ({
...prev,
showHelpButton: true,
showExternalLinks: screenType !== "mobilePortrait",
showExternalLinks: true,
showWallet: false,
}));
}, [active, currentHelpRoute]);
Expand Down
9 changes: 5 additions & 4 deletions packages/app/src/grow/GrowApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { partners } from "./partners";
import { PartnerButton } from "./components/PartnerButton";
import { OrgButtonContent } from "./OrgButtonContent";
import { LinkWithQuery } from "../common/components/LinkWithQuery";
import { useScreenOrientation } from "../hub/hooks/useScreenOrientation";

const Placeholder: FC<PropsWithChildren> = ({ children }) => (
<div className="transition-all text-xl font-medium text-center text-green hover:text-green-light border border-green hover:border-green-light p-8 rounded-md w-40 h-40 hover:scale-105 hover:brightness-105">
Expand All @@ -44,7 +43,6 @@ const _GrowApp: ForwardRefRenderFunction<

const navigate = useNavigate();
const wallet = useWallet();
const { screenType } = useScreenOrientation();
useEffect(() => {
if (!wallet.connected && active) navigate("/");
}, [active, wallet.connected]);
Expand All @@ -55,7 +53,7 @@ const _GrowApp: ForwardRefRenderFunction<
...prev,
showBGImage: false,
showHelpButton: true,
showExternalLinks: screenType !== "mobilePortrait",
showExternalLinks: true,
showWallet: active,
}));
}, [active, currentHelpRoute]);
Expand All @@ -64,7 +62,10 @@ const _GrowApp: ForwardRefRenderFunction<

return (
<div
className={clx("relative flex flex-col items-center pt-8", className)}
className={clx(
"relative flex flex-col items-center pt-8 pb-12",
className
)}
ref={ref}
{...rest}
>
Expand Down
Loading

0 comments on commit 891cce3

Please sign in to comment.