Skip to content

Commit

Permalink
adding images to pages and updating context issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KobeZ123 committed Nov 3, 2024
1 parent d56750c commit 47e229e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 27 deletions.
58 changes: 38 additions & 20 deletions packages/frontend/components/Header/GraduateHeaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
Text,
Box,
useMediaQuery,
Stack,

Check failure on line 18 in packages/frontend/components/Header/GraduateHeaders.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'Stack' is defined but never used. Allowed unused vars must match /^_/u
HStack,

Check failure on line 19 in packages/frontend/components/Header/GraduateHeaders.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'HStack' is defined but never used. Allowed unused vars must match /^_/u
} from "@chakra-ui/react";
import { MetaInfoWidget } from "../MetaInfo/MetaInfo";
import { HamburgerIcon, RepeatClockIcon } from "@chakra-ui/icons";
Expand Down Expand Up @@ -50,30 +52,46 @@ interface GraduateHeaderProps {
}

const GraduateHeader: React.FC<GraduateHeaderProps> = ({ rightContent }) => {
return (
<WhatsNewModalContextProvider>
<GraduateHeaderContent rightContent={rightContent} />
</WhatsNewModalContextProvider>
);
};

const GraduateHeaderContent: React.FC<GraduateHeaderProps> = ({
rightContent,
}) => {
const { openModal } = useWhatsNewModal();

return (
<WhatsNewModalContextProvider>
<HeaderContainer>
<Logo />
<Flex columnGap="md" alignItems="center">
<MetaInfoWidget />
<Box onClick={openModal}>
<LatestReleaseNotesIcon mx="2px" />
Latest Release Notes
</Box>
<ChakraLink href="https://forms.gle/uXDfLFWvgCiYcqgf9" isExternal>
<FeedbackIcon mx="2px" />
Feedback
</ChakraLink>
<ChakraLink href="https://forms.gle/bXgRXyYTXN8wgYy78" isExternal>
<BugIcon mx="2px" />
Bug/Feature
</ChakraLink>
{rightContent}
<HeaderContainer>
<Logo />
<Flex columnGap="md" alignItems="center">
<MetaInfoWidget />
<Flex
onClick={() => {
openModal();
}}
cursor="pointer"
_hover={{ textDecoration: "underline" }}
wrap="wrap"
alignItems="center"
>
<LatestReleaseNotesIcon mx="4px" />
<Text>Latest Release Notes</Text>
</Flex>
</HeaderContainer>
</WhatsNewModalContextProvider>
<ChakraLink href="https://forms.gle/uXDfLFWvgCiYcqgf9" isExternal>
<FeedbackIcon mx="2px" />
Feedback
</ChakraLink>
<ChakraLink href="https://forms.gle/bXgRXyYTXN8wgYy78" isExternal>
<BugIcon mx="2px" />
Bug/Feature
</ChakraLink>
{rightContent}
</Flex>
</HeaderContainer>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Box,
Button,
HStack,
Image,
Expand All @@ -10,6 +9,9 @@ import {
Text,
} from "@chakra-ui/react";
import { ModalBodyPagination } from "./ModalBodyPagination";
import InProgressIndicatorImage from "../../public/in-progress-indicator.png";
import SearchNEUIntegrationImage from "../../public/searchneu-integration.png";
import { InfoOutlineIcon } from "@chakra-ui/icons";

interface ModalContentProps {
onClose: () => void;
Expand Down Expand Up @@ -71,7 +73,7 @@ const InProgressIndicatorFeaturePage: React.FC = () => {
are currently in progress!
</Text>
}
image="https://placehold.co/600x400"
image={InProgressIndicatorImage.src}
/>
);
};
Expand All @@ -86,12 +88,15 @@ const SearchNEUIntegrationFeaturePage: React.FC = () => {
Want to know more about a class before adding it to the plan?{" "}
</Text>
<Text>
Click on the new <span>i</span> button to read more about a class on
SearchNEU
Click on the new{" "}
<span>
<InfoOutlineIcon />
</span>{" "}
button to read more about a class on SearchNEU
</Text>
</Stack>
}
image="https://placehold.co/600x400"
image={SearchNEUIntegrationImage.src}
/>
);
};
Expand All @@ -111,7 +116,14 @@ const NewFeaturePage: React.FC<NewFeaturePageProps> = ({
<HStack pt="8" alignItems="start" gap="8">
<NewFeatureText title={title} descriptionSection={descriptionSection} />
<Stack flex="3">
<Image src={image} borderRadius="2xl" />
<Image
src={image}
alt={title + " image"}
fit={"contain"}
maxWidth={400}
maxHeight={300}
borderRadius="2xl"
/>
</Stack>
</HStack>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export const WhatsNewModalContextProvider = ({
children: ReactNode;
}) => {
const [isOpen, setIsOpen] = useState(false);
const openModal = () => setIsOpen(true);
const openModal = () => {
console.log("openModal");
setIsOpen(true);
};
const cookies = new Cookies();

Check warning on line 26 in packages/frontend/components/WhatsNewModal/WhatsNewModalContextProvider.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

The 'cookies' object construction makes the dependencies of useEffect Hook (at line 34) change on every render. To fix this, wrap the initialization of 'cookies' in its own useMemo() Hook

useEffect(() => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 47e229e

Please sign in to comment.