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

OV-38: Add homepage #57

Merged
merged 22 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f1b5204
OV-38: + basic video section component
Sanchousina Aug 22, 2024
56df2b6
OV-38: + basic main section component for home page
Sanchousina Aug 22, 2024
c39ad56
OV-38: + basic home page component
Sanchousina Aug 22, 2024
86b0c5a
OV-38: * add home page to app routes
Sanchousina Aug 22, 2024
bb98ddb
OV-38: - margin bottom from header
Sanchousina Aug 22, 2024
f66caed
OV-38: + video card component
Sanchousina Aug 22, 2024
e852b92
OV-38: + video card color overlay effect on hover
Sanchousina Aug 22, 2024
39a50f8
OV-38: + edit icon on video card hover
Sanchousina Aug 22, 2024
21943da
OV-38: + reusable icon component
Sanchousina Aug 22, 2024
f0b47b7
OV-38: + number of videos indicator
Sanchousina Aug 22, 2024
c4c7354
OV-38: - fragment wrappers
Sanchousina Aug 23, 2024
78c6128
OV-38: * use badge instead of box
Sanchousina Aug 23, 2024
d292f55
OV-38: * import chackra ui components from components.ts
Sanchousina Aug 23, 2024
6d99874
OV-38: + icons folder for fa icons
Sanchousina Aug 23, 2024
cb3da0b
OV-38: + export all home components
Sanchousina Aug 23, 2024
ef50774
OV-38: * use chakra iconButton instead of custom icon component
Sanchousina Aug 23, 2024
208fe75
OV-38: - custom icon button component
Sanchousina Aug 23, 2024
0af2906
Merge remote-tracking branch origin/next into task/OV-38-add-homepage
Sanchousina Aug 23, 2024
8671186
OV-38: + home page route to protected routes
Sanchousina Aug 23, 2024
e93e218
OV-38: * generalize icons approach
Sanchousina Aug 26, 2024
ab7720d
OV-38: + add comment about mocked data
Sanchousina Aug 27, 2024
ab5375d
OV-38: * icons structure
Sanchousina Aug 27, 2024
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
Binary file added frontend/src/assets/img/photo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/src/bundles/common/components/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export { VideoModal } from './video-modal/video-modal.js';
export { DownloadIcon } from '@chakra-ui/icons';
export { ViewIcon, ViewOffIcon } from '@chakra-ui/icons';
export {
Badge,
Box,
Center,
Circle,
Expand All @@ -18,7 +19,9 @@ export {
FormControl,
FormErrorMessage,
Heading,
Icon,
IconButton,
Image,
InputGroup,
InputRightElement,
SimpleGrid,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/bundles/common/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Header: React.FC<Properties> = ({ left, center, right }) => {
boxShadow="md"
zIndex="1000"
padding="4"
marginBottom="20px"
alignItems="center"
justifyContent="space-between"
>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/bundles/common/icons/icon-name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { faEllipsisVertical, faPen } from '@fortawesome/free-solid-svg-icons';

const IconName = {
OPTIONS_VERTICAL: faEllipsisVertical,
PEN: faPen,
} as const;

export { IconName };
1 change: 1 addition & 0 deletions frontend/src/bundles/common/icons/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { IconName } from './icon-name.js';
3 changes: 3 additions & 0 deletions frontend/src/bundles/home/components/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { MainContent } from './main-content/main-content.js';
export { VideoCard } from './video-card/video-card.js';
export { VideoSection } from './video-section/video-section.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Box } from '~/bundles/common/components/components.js';

import { VideoSection } from '../components.js';

const MainContent: React.FC = () => {
return (
<Box bg="background.50" borderRadius="lg" margin="0 25px">
<VideoSection />
<VideoSection />
</Box>
);
};

export { MainContent };
92 changes: 92 additions & 0 deletions frontend/src/bundles/home/components/video-card/video-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import photo from '~/assets/img/photo.png';
import {
Box,
Flex,
Icon,
IconButton,
Image,
Text,
} from '~/bundles/common/components/components.js';
import { IconName } from '~/bundles/common/icons/icons.js';

const VideoCard: React.FC = () => {
return (
<Box borderRadius="8px" bg="white" padding="7px">
<Box position="relative" role="group">
<Image src={photo} alt="Video preview" borderRadius="5px" />

{/* Overlay effect */}
<Box
position="absolute"
top="0"
left="0"
width="100%"
height="100%"
bg="rgba(53, 57, 154, 0.3)"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
borderRadius="5px"
/>

<IconButton
aria-label="Video options"
position="absolute"
bg="white"
top="5px"
right="5px"
size="xs"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
icon={
<Icon
as={FontAwesomeIcon}
icon={IconName.OPTIONS_VERTICAL}
color="background.600"
/>
}
/>

<IconButton
aria-label="Edit video"
isRound={true}
size="lg"
position="absolute"
bg="white"
top="50%"
left="calc(50% - 12.5px)"
transform="translate(-50%, -50%)"
opacity="0"
transition="opacity 0.3s ease"
_groupHover={{ opacity: 1 }}
icon={
<Icon
as={FontAwesomeIcon}
icon={IconName.PEN}
color="background.600"
/>
}
/>
</Box>

<Box padding="7px 10px 5px 5px">
<Text variant="button" color="typography.900">
Video Name
</Text>
<Flex justify="space-between">
<Text variant="caption" color="typography.300">
Aug 9, 2024, 1:24 PM
</Text>
<Text variant="caption" color="typography.300">
0,30 sec
</Text>
</Flex>
</Box>
</Box>
);
};

export { VideoCard };
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {
Badge,
Box,
Flex,
Heading,
SimpleGrid,
} from '~/bundles/common/components/components.js';

import { VideoCard } from '../components.js';

const VideoSection: React.FC = () => {
return (
<Box padding="17px 28px">
<Flex alignItems="center" marginBottom="9px">
<Heading color="typography.900" variant="H3" marginRight="11px">
Videos
</Heading>
<Badge
color="background.600"
bg="#D1D4DB"
fontWeight="400"
padding="2px 10px"
>
23
</Badge>
</Flex>
<SimpleGrid minChildWidth="253px" spacing="20px">
{/* TODO: Update this mocked data */}
<VideoCard />
Copy link
Collaborator

Choose a reason for hiding this comment

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

leave comment that is mocked data, and we need to update it

<VideoCard />
<VideoCard />
<VideoCard />
<VideoCard />
</SimpleGrid>
</Box>
);
};

export { VideoSection };
15 changes: 15 additions & 0 deletions frontend/src/bundles/home/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Box, Header } from '~/bundles/common/components/components.js';

import { MainContent } from '../components/components.js';

const Home: React.FC = () => {
return (
<Box bg="background.900" height="100vh">
<Header />
{/* Sidebar */}
<MainContent />
</Box>
);
};

export { Home };
5 changes: 5 additions & 0 deletions frontend/src/router/routes/protected-routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Navigate } from 'react-router-dom';

import { AppRoute } from '~/bundles/common/enums/app-route.enum.js';
import { Home } from '~/bundles/home/pages/home.js';
import { Studio } from '~/bundles/studio/pages/studio.js';

import { ProtectedRoute } from '../components/protected-route.js';
Expand All @@ -10,6 +11,10 @@ const protectedRoutes = {
element: <ProtectedRoute />,
children: [
//TODO Add protected routes here in element property and specify the correct path
{
path: AppRoute.ROOT,
element: <Home />,
},
{
path: AppRoute.STUDIO,
element: <Studio />,
Expand Down
Loading