Skip to content

Commit

Permalink
Tweak styling
Browse files Browse the repository at this point in the history
  • Loading branch information
nzws committed May 22, 2024
1 parent 55558cf commit 2543523
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 24 deletions.
9 changes: 5 additions & 4 deletions apps/web/organisms/footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
MenuItem,
Icon,
LinkOverlay,
LinkBox
LinkBox,
HStack
} from '@chakra-ui/react';
import Link from 'next/link';
import { FC } from 'react';
Expand All @@ -25,10 +26,10 @@ export const Footer: FC = () => {

return (
<Box marginTop="auto">
<Container as={Stack} maxW="container.xl" py={8}>
<Container as={Stack} maxW="full" py={8}>
<Divider mb={2} />

<Stack as={Stack} direction={{ base: 'column', lg: 'row' }} spacing={6}>
<HStack flexWrap="wrap" spacing={6}>
<Box color="gray.400">
<ChakraLink href="https://github.com/nzws/knzklive2" isExternal>
<Icon as={FiGithub} mr={2} />
Expand Down Expand Up @@ -85,7 +86,7 @@ export const Footer: FC = () => {
</MenuList>
</Menu>
</Box>
</Stack>
</HStack>
</Container>
</Box>
);
Expand Down
37 changes: 31 additions & 6 deletions apps/web/organisms/live/comment-post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const CommentPost: FC<Props> = ({ liveId, hashtag }) => {
);
const [comment, setComment] = useState('');
const [isLoading, setIsLoading] = useState(false);
const fediverseSyncPopoverDisclosure = useDisclosure();
const {
isOpen: fediSyncPopoverIsOpen,
onOpen: fediSyncPopoverOnOpen,
onClose: fediSyncPopoverOnClose
} = useDisclosure();
const { handlePublish } = useCommentPublish(liveId, hashtag);
const [error, setError] = useState<unknown>();
useAPIError(error);
Expand Down Expand Up @@ -72,27 +76,43 @@ export const CommentPost: FC<Props> = ({ liveId, hashtag }) => {
[comment, token, enablePublish, handlePublish, hashtag]
);

const onOpen = fediverseSyncPopoverDisclosure.onOpen;
useEffect(() => {
if (!isSignedIn && hashtag) {
const timeoutId = setTimeout(() => {
onOpen();
fediSyncPopoverOnOpen();
}, 1000 * 3);

return () => {
clearTimeout(timeoutId);
};
}
}, [isSignedIn, onOpen, hashtag]);
}, [isSignedIn, fediSyncPopoverOnOpen, hashtag]);

useEffect(() => {
if (!fediSyncPopoverIsOpen) {
return;
}

const handler = () => {
fediSyncPopoverOnClose();
};

document.addEventListener('click', handler);

return () => {
document.removeEventListener('click', handler);
};
}, [fediSyncPopoverOnClose, fediSyncPopoverIsOpen]);

return (
<form onSubmit={handleSubmit}>
<Popover
isOpen={fediverseSyncPopoverDisclosure.isOpen}
onClose={fediverseSyncPopoverDisclosure.onClose}
isOpen={fediSyncPopoverIsOpen}
onClose={fediSyncPopoverOnClose}
placement="bottom"
closeOnBlur
isLazy
autoFocus={false}
>
<PopoverAnchor>
<InputGroup>
Expand All @@ -115,6 +135,11 @@ export const CommentPost: FC<Props> = ({ liveId, hashtag }) => {
)}
isDisabled={!isSignedIn}
maxLength={100}
borderTopRadius={0}
borderBottomRadius={{
base: 8,
md: 15
}}
/>

<InputRightElement width="6rem">
Expand Down
17 changes: 17 additions & 0 deletions apps/web/organisms/live/comment-post/public-post-switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ export const PublicPostSwitch: FC<Props> = ({
}
}, [onOpen, hashtag, enablePublish, isSignedIn]);

useEffect(() => {
if (!isOpen) {
return;
}

const handler = () => {
onClose();
};

document.addEventListener('click', handler);

return () => {
document.removeEventListener('click', handler);
};
}, [isOpen, onClose]);

return (
<Fragment>
<Popover
Expand All @@ -63,6 +79,7 @@ export const PublicPostSwitch: FC<Props> = ({
closeOnBlur
isLazy
offset={[28, 24]}
autoFocus={false}
>
<Tooltip
label={intl.formatMessage({
Expand Down
3 changes: 3 additions & 0 deletions apps/web/organisms/live/live-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export const LiveApp: FC<Props> = ({ live, streamer }) => {
overflowY="auto"
width={{ lg: 'calc(100% - 400px)' }}
flexShrink={0}
sx={{
scrollbarWidth: 'none'
}}
>
{url ? (
<LivePlayer
Expand Down
16 changes: 9 additions & 7 deletions apps/web/organisms/live/video/live-player.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AspectRatio, Center, Spinner } from '@chakra-ui/react';
import { AspectRatio, Box, Center, Spinner } from '@chakra-ui/react';
import styled from '@emotion/styled';
import { FC, useCallback, useEffect, useRef, useState } from 'react';
import { useAPIError } from '~/utils/hooks/api/use-api-error';
Expand Down Expand Up @@ -154,12 +154,18 @@ export const LivePlayer: FC<Props> = ({
}, [canPlay, autoSeek]);

return (
<Container
<Box
{...events}
ref={containerRef}
style={{
cursor: show ? 'auto' : 'none'
}}
position="relative"
borderTopRadius={{
base: 8,
md: 15
}}
overflow="hidden"
>
<VideoContainer
ratio={16 / 9}
Expand Down Expand Up @@ -191,14 +197,10 @@ export const LivePlayer: FC<Props> = ({
playType={playType}
onChangePlayType={setPlayType}
/>
</Container>
</Box>
);
};

const Container = styled.div`
position: relative;
`;

const VideoContainer = styled(AspectRatio)`
background-color: #000;
background-position: center;
Expand Down
5 changes: 5 additions & 0 deletions apps/web/organisms/live/video/video-message-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export const VideoMessageBox: FC<Props> = ({
thumbnailUrl || `/api/default-thumbnail.png?userId=${streamerUserId}`
})`
}}
borderTopRadius={{
base: 8,
md: 15
}}
overflow="hidden"
>
<Inner>
<Flex>
Expand Down
13 changes: 10 additions & 3 deletions apps/web/organisms/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ export const Navbar: FC = () => {
/>
)}

<Box as="nav" bg="gray.900">
<Container py={{ base: '3' }} maxW="container.xl">
<HStack spacing="10" justify="space-between">
<Box as="nav">
<Container py={{ base: 3 }} maxW="full">
<HStack
gap={4}
px={{
base: 0,
md: 4
}}
justify="space-between"
>
<Link href="/">
<Heading size="md">KnzkLive</Heading>
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const Page: NextPage<PageProps<Props, Params & PathProps>> = ({
<Grid
gridTemplateRows="auto 1fr auto"
gridTemplateColumns="1fr"
height="100vh"
height="100dvh"
>
<GridItem>
{live && (
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
# db:
# image: postgres:16
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"lint": "prettier --check --cache .",
"format": "prettier --write --cache .",
"dev-all": "docker compose up -d redis && yarn dev:migrate && yarn workspaces foreach --verbose --parallel -j unlimited --interlaced run dev",
"dev-all": "docker compose up -d redis && yarn dev:migrate && yarn workspaces foreach --worktree --verbose --parallel -j unlimited --interlaced run dev",
"dev": "docker compose up --build",
"dev:migrate": "yarn workspace server prisma migrate dev",
"dev:sql": "yarn workspace server prisma studio",
Expand Down

0 comments on commit 2543523

Please sign in to comment.