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

Update Referral look and mobile optimizations #286

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
18 changes: 13 additions & 5 deletions packages/app/src/common/components/tree/DynamicTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,20 @@ const width = (index: number, total: number): string => {
};

export const DynamicTree: FC<{
className?: string;
details: TreeComponent;
style?: CSSProperties;
islandHeight?: number;
onClick?: () => void;
className?: string;
style?: CSSProperties;
variant?: "sm" | "md";
}> = ({ details, style = {}, onClick, className = "", variant = "md" }) => {
}> = ({
className = "",
details,
islandHeight = 300,
onClick,
style = {},
variant = "md",
}) => {
const { level, species } = details.metadata.type;

const treeImages = [];
Expand Down Expand Up @@ -119,8 +127,8 @@ export const DynamicTree: FC<{
<Island
className={
variant === "sm"
? "w-[300px] h-[300px] scale-50"
: "w-[300px] h-[300px]"
? `w-[300px] h-[${islandHeight}px] scale-50`
: `w-[300px] h-[${islandHeight}px]`
}
>
{components}
Expand Down
15 changes: 9 additions & 6 deletions packages/app/src/common/container/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import { type FC, type PropsWithChildren, type ReactNode } from "react";
import clx from "classnames";

interface CardProps {
title?: string;
className?: string;
title?: string | ReactNode;
image?: ReactNode;
orientation?: "horizontal" | "vertical";
size?: "small" | "medium" | "large";
}

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