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

Post submission layout bug fixes and workspace hoisting #19

Merged
merged 7 commits into from
Aug 29, 2021
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ Additionally, the restful backend API can be viwed at [cheathub-backend.herokuap

<br />

## In Development

> [***Collaborate on this project***](https://github.com/israelias/cheathub/blob/master/CONTRIBUTING.md#)

> [***Send feedback anonymously***](https://gvklqnr2996.typeform.com/to/xVAAK1V0)

<br />

> **Note:** Scripts in root `package.json` implement Yarn workspaces only to run development-specific scripts from root assuming all backend/frontend-specific configs have been set up. Running `yarn` from root has not yet been tested. For the meantime, `cd`ing to frontend and installing the React-App is the minimal reliable option to develop the app with a fixed and unchanging backend API. The backend `package.json` is solely for running python scripts from root. Backend API and data layer are superuser-specific given the production deployment, although local env variables are described in case anyone wants to locally serve a Mongo Atlas connection string from scratch. To be updated.

[TOC levels=3]: # "## Contents"
## Contents
- [UX](#ux)
Expand Down
2 changes: 1 addition & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Running Frontend Locally
The frontend directory can developed on its own as a standalone React App attached to the live backend API. The ORM spec is defined as types in `globals.d.ts`. All fetch handlers that communicate with the backend are in the `src/services` subdirectory. Please see `src/context` for their implementation in context providers via Hooks and Context API.

> Note: Please `cd` to this directory from root until workspaces is implented.
> Note: Please `cd` to this directory from root until workspaces is implemented.

- `yarn install`
- `yarn start`
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/collections/collection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import '../styles.css';
*
* A card/accordion counterpart of CollectionItem
* Relies on State and setState props passed by Collection page.
*
* TODO Adjust text wrapping so title stays in one line
* TODO Adjust top margin in Collections primary page to be consistent with Snippets primary page
* @see CollectionCrud
* @file defines Collections page route
* @since 2021-04-08
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/components/collections/crud/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Box,
Input,
Flex,
useMediaQuery,
useColorModeValue as mode,
} from '@chakra-ui/react';
import Select from 'react-select';
Expand All @@ -26,6 +27,7 @@ import { useProfileData } from '../../../context/profiledata.context';
*
* A form counterpart of CollectionItem
* Relies on State and setState props passed by Collection page.
* TODO Update default value of MultiSelect
* @see CollectionItem
* @file defines Collection form.
* @date 2021-05-03
Expand Down Expand Up @@ -57,6 +59,7 @@ const CollectionCrud: React.FC<{
}) => {
const { snippetsOptions } = useProfileData();
const color = mode('light', 'dark');
const [baseLg] = useMediaQuery('(min-width: 62em)');
// React.useEffect(() => {
// if (snippets.length < 1) {
// setSnippets([]);
Expand Down Expand Up @@ -241,7 +244,16 @@ const CollectionCrud: React.FC<{
</MotionBar>
<Box height="100%"> </Box>
</AnimatePresence>
<Box position="sticky" width="100%" mt="auto" bottom={0}>
<Box
position="sticky"
// width="100%"
mt="auto"
pt="16px"
top="80vh"
ml={baseLg ? 0 : '-8px'}
mr={baseLg ? 0 : '-8px'}
bottom={0}
>
<SecondaryFooter>
{editing && (
<MotionForm
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/shared/particulars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
Heading,
} from '@chakra-ui/react';

// TODO Adjust footer horizontals in light-mode to have consistent bg color

const PrimaryHeader: React.FC<{
heading?: string;
left?: boolean;
Expand Down Expand Up @@ -232,6 +234,10 @@ const SecondaryFooter: React.FC<{
bottom={0}
mt="auto"
pt="auto"
// ml="-8px"
// mr="-16px"
// ml={baseLg ? 0 : '-8px'}
// mr={baseLg ? 0 : '-8px'}
position="sticky"
zIndex="banner"
>
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/components/snippet/crud/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
Switch,
Divider,
useColorModeValue as mode,
useMediaQuery,
Select,
} from '@chakra-ui/react';

Expand Down Expand Up @@ -98,6 +99,7 @@ const SnippetCrud: React.FC<{
handleCancel,
}) => {
const languages = [{ value: '', label: 'All' }, ...LANGUAGES];
const [baseLg] = useMediaQuery('(min-width: 62em)');
return (
<AnimatePresence exitBeforeEnter>
<MotionBar
Expand Down Expand Up @@ -268,7 +270,16 @@ const SnippetCrud: React.FC<{
</AnimatePresence>
</MotionBar>

<Box position="sticky" width="100%" mt="auto" bottom={0}>
<Box
position="sticky"
// width="100%"
mt="auto"
pt="16px"
top="80vh"
ml={baseLg ? 0 : '-8px'}
mr={baseLg ? 0 : '-8px'}
bottom={0}
>
{' '}
<SecondaryFooter>
{editing && (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/default.container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const Page: React.FC<{
<Box
display="flex"
flexDirection="column"
mt="atuo"
mt="auto"
mb="auto"
>
{baseLg ? (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/context/collectionhandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function CollectionHandlerProvider({

const clearValues = () => {
setId('');
setName('Collection Name');
setName('');
setSnippets([]);
};

Expand Down
12 changes: 0 additions & 12 deletions frontend/tsconfig.eslint.json

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"scripts": {
"start": "concurrently \"yarn start:frontend\" \"yarn start:backend\"",
"start:frontend": "yarn workspace @cheathub/frontend start",
"start:backend": "yarn workspace @cheathub/backend start"
"start:backend": "yarn workspace @cheathub/backend start",
"build:frontend": "yarn workspace @cheathub/frontend build",
"test:frontend": "yarn workspace @cheathub/frontend test"
},
"workspaces": [
"frontend",
Expand Down