Skip to content

Commit

Permalink
styling for screens when somethings wrong in view plants
Browse files Browse the repository at this point in the history
  • Loading branch information
SashankBalusu committed Dec 21, 2024
1 parent 6601db6 commit acdcf84
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 11 deletions.
103 changes: 92 additions & 11 deletions app/view-plants/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from '@/api/supabase/queries/plants';
import { getCurrentUserPlantsByUserId } from '@/api/supabase/queries/userPlants';
import FilterDropdownMultiple from '@/components/FilterDropdownMultiple';
import Icon from '@/components/Icon';
import PlantCard from '@/components/PlantCard';
import SearchBar from '@/components/SearchBar';
import COLORS from '@/styles/colors';
Expand Down Expand Up @@ -36,6 +37,7 @@ import {
NumberSelectedPlantsContainer,
PlantGridContainer,
SelectButton,
SomethingWrongButton,
TopRowContainer,
ViewSelection,
} from './styles';
Expand Down Expand Up @@ -191,21 +193,51 @@ export default function Page() {
// Not logged in
if (!userId) {
return (
<Flex $direction="column" $textAlign="center" $justify="center">
<P1 $color={COLORS.midgray}>Login to view all plants</P1>
<button onClick={() => router.push('/login')}>Log In</button>
<Flex
$direction="column"
$textAlign="center"
$justify="center"
$w="240px"
$align="center"
$m="auto"
$p="20px"
$gap="8px"
$h="60vh"
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>Log In to view all plants</P1>
<SomethingWrongButton
$width="170px"
onClick={() => router.push('/login')}
>
Log In
</SomethingWrongButton>
</Flex>
);
}

// Not onboarded
if (!profileData) {
return (
<Flex $direction="column" $textAlign="center" $justify="center">
<Flex
$direction="column"
$textAlign="center"
$justify="center"
$w="320px"
$align="center"
$m="auto"
$p="20px"
$gap="8px"
$h="60vh"
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>Complete your profile view all plants</P1>
<button onClick={() => router.push('/onboarding')}>
<SomethingWrongButton
$width="170px"
onClick={() => router.push('/onboarding')}
>
Go To Onboarding
</button>
</SomethingWrongButton>
</Flex>
);
}
Expand Down Expand Up @@ -261,9 +293,44 @@ export default function Page() {
return (
<div>
{ownedPlants.length === 0 ? (
<>Add Plants To Your Garden</>
<Flex
$direction="column"
$textAlign="center"
$justify="center"
$w="220px"
$align="center"
$m="auto"
$p="20px"
$gap="8px"
$h="60vh"
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>Your plant list is empty</P1>
<SomethingWrongButton
$width="125px"
onClick={() => setViewingOption('all')}
>
Add Plants
</SomethingWrongButton>
</Flex>
) : filteredUserPlantList.length === 0 ? (
<p>No plants match your current filters.</p>
<Flex
$direction="column"
$textAlign="center"
$justify="center"
$w="220px"
$align="center"
$m="auto"
$p="20px"
$gap="8px"
$h="60vh"
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>No matching plants</P1>
<SomethingWrongButton $width="125px" onClick={() => clearFilters()}>
Clear Filters
</SomethingWrongButton>
</Flex>
) : (
<PlantGridContainer>
{filteredUserPlantList.map(ownedPlant => (
Expand All @@ -285,9 +352,23 @@ export default function Page() {
return (
<>
{filteredPlantList.length === 0 ? (
<div>
<p>No plants match your current filters.</p>
</div>
<Flex
$direction="column"
$textAlign="center"
$justify="center"
$w="220px"
$align="center"
$m="auto"
$p="20px"
$gap="8px"
$h="60vh"
>
<Icon type="sprout"></Icon>
<P1 $color={COLORS.midgray}>No matching plants</P1>
<SomethingWrongButton $width="125px" onClick={() => clearFilters()}>
Clear Filters
</SomethingWrongButton>
</Flex>
) : (
<PlantGridContainer>
{filteredPlantList.map(plant => (
Expand Down
10 changes: 10 additions & 0 deletions app/view-plants/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,13 @@ export const NumberSelectedPlants = styled.p`
line-height: 16px;
color: #fff;
`;

export const SomethingWrongButton = styled.button<{ $width: string }>`
width: ${({ $width }) => $width};
height: 45px;
border-radius: 50px;
background-color: ${COLORS.shrub};
color: white;
border: none;
font-family: inherit;
`;
27 changes: 27 additions & 0 deletions lib/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,33 @@ export const IconSvgs = {
<path d="M1 1L10 10" stroke="#E94444" strokeWidth="1.5" />
</svg>
),
sprout: (
<svg
width="46"
height="45"
viewBox="0 0 46 45"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<rect x="0.5" width="45" height="45" fill="url(#pattern0_1519_16733)" />
<defs>
<pattern
id="pattern0_1519_16733"
patternContentUnits="objectBoundingBox"
width="1"
height="1"
>
<use href="#image0_1519_16733" transform="scale(0.0111111)" />
</pattern>
<image
id="image0_1519_16733"
width="90"
height="90"
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAACXBIWXMAAAsTAAALEwEAmpwYAAAHX0lEQVR4nO1caYxURRB+K953vOKB4oHAvqq3oGuUeC3IMt2zEIyREWM0olFIQI6d6tmFP64/ROMV4xEDiwnRKMYYNUpUNCgmoqiJmCgqCqIcIooIIojg7mLqzaK4Tr9r38ybme0v6T+TedX1vlddXd1V3ZZlYGBgYGBgYGBgYGBgUD5IZ+sGCeVMlArvl4SLJMEHgvBLQfijJNwtFe4L05J+n7JBJpPpl1K2FITtUuGmsEQaon0gpw08VpLTKgnXxU2usWgrb8GCcLpQuKWYBPdp15HK4hCh8MNSENxniU4pW0qC7aUkOVaiA3dKuJtnbp7Bu2fydqFwssg5F9ZPqj/EKiJShLcIBR2lJjkZoj2aUPibVLiQra6tzTooNuVYP7LHJ0Vy2REt/2P5sEoSXG9ZVk2vdSPblgp2JkVyeROtuq2ccFljrvb8qHqxOxIKPkuSZEG4p+yJlm5zrfGaKHpxCJckyS7RCrZVCNHIVtEpsnBbGJ1GU91RUuHWMiB6Y8UQLfMKd4SxbI5mkiY53+DzOInuKonSBNvHzHTODaQTwSfJk+yGtItiI1oQ7CqV4kLB6376NOYGnx7Dx+8SCuY1kXNlmuyrhIJnIulL8GicRP9cUivJOqM89clvcfZ29EzpKVcqnB/eMOyp8RGt4OtSEi0Uvuqlj1TwWC/7aNP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5u6VhwsmcVkpPKwUih4FsmUyj8M5+MgM2C4F12Ne6coIm5+wxEiCSsyDmDk9a3YiHdeN0/Ay8UfpG0rhUPGWQVSjgnaT0rHiLAPngqC5cmrWfFo6Gt4WBB8KtXuMiTb9J6VgUk4Rse/nlF0vpVDQTBXR6uY37S+lUN0jmYoJ8InUlJ61c1aKLaS7QTYQ5GJq1f1UB618TVJa1f1eDqGUOP1xHtl70xCAE3oaoh2oR2MSOTyfSLW6aBgYGBgYGBwQGFkART+IAPbx656SjCPULBH1xulv8NFnDdtWgdenb3YwbBb/RybohQIM4HNJcIwutMKOgDrqWIcszhf1unhJ/yiVirGuGW9OacKzhtLxQs78547/1nmBMuE4QPcNa5p8XxgSI+hdVbggu0Tdx//qoKWMsHkKSCezhrwwkFq5LAS+B8KSwTG9DiFGwUhLO5fIuLH4XCj4tAsk9j4u2pFbGEd+8yItgQfYjDhlIffy7gZtb4HXJKDO5xOMI5JbteQhWdbC6sX+re+JgvsNnZXbyzmE8X8MHUREgWCp9LmhxZyg+hoIOrrvgoSMmI7rbkxF9eJmP5O0TWHlcCku3x1eIuZHSyO4OUHkdG/kw3rk/6RWUZtPxlW0Wy7F6cZtpXrW4k9jSaW0IbIk7uQ21+rETnV3yJv9S+cmvucQ39jQ7h4R43KIMXk2XY4r68annSLyTLtPF5x8q9jk1VUCNYFSPRka7W6Svt99iINjAwMDAwMDAwMDAwsBLA35J4WT6x2ZrIAAAAAElFTkSuQmCC"
/>
</defs>
</svg>
),
};

export type IconType = keyof typeof IconSvgs;

0 comments on commit acdcf84

Please sign in to comment.