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

M-6 Activity Create UI #12

Merged
merged 69 commits into from
Jan 11, 2024
Merged

M-6 Activity Create UI #12

merged 69 commits into from
Jan 11, 2024

Conversation

SachiGoto
Copy link
Contributor

Description

giphy.1.mp4

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have made the title field required so that people can quickly add a new activity and add more information later.

I am unsure about how we are handling images. Are we storing images in the cloud and storing their CDN in the database? Currently, once images are added and the submit button is clicked, it stores image information like the example below:
Screenshot 2023-12-03 at 2 01 57 AM

Copy link
Contributor

@Yo-mah-Ya Yo-mah-Ya left a comment

Choose a reason for hiding this comment

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

lgtm !

Yo-mah-Ya

This comment was marked as duplicate.

Copy link
Contributor

@Yo-mah-Ya Yo-mah-Ya left a comment

Choose a reason for hiding this comment

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

Cancel Approve, cuz CI didn't pass.

@SachiGoto
Copy link
Contributor Author

Cancel Approve, cuz CI didn't pass.

Oh sorry about that! I just fixed the error!

import { PrimaryButton } from '@/components/button'
import { createActivitySchema, createActivityResolver } from './schema'

export const Form = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to say FormActivity which is more clearly and easier to search!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name to FormActivity!

Comment on lines 22 to 34
<Container
maxW={{ base: '100%', md: 'container.md' }}
pt={{ base: '20px', md: '30px' }}
pb={{ base: '40px', md: '80px' }}
margin="auto"
>
<Container>
<Heading as={'h1'} fontSize={{ base: '2xl', md: '4xl' }}>
Create Activity
</Heading>
</Container>
<Form />
</Container>
Copy link
Contributor

@kanatagu kanatagu Dec 7, 2023

Choose a reason for hiding this comment

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

<Container /> is usually one per page. Please change to one <Container /> with container.md for PC as you already use for top layer. You don't need to use <Container /> in Form component too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the extra container tags in page.tsx under the create directory, and removed container tags in form.tsx under the components directory. Could you please take a quick look and let me know if it looks good?

mt={{ base: '30px', md: '40px' }}
isInvalid={!!errors.timeFrom}
>
<FormLabel>Time From</FormLabel>
Copy link
Contributor

Choose a reason for hiding this comment

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

Activity can be not only one day so I think we need to show date too...
If ChakraUI doesn't provide such the components, we need to make ourselves. Using like React Datepicker...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used Date and time Picker Chakra provides so users can add date and time in one input field!
https://chakra-ui.com/docs/components/input/usage#:~:text=Input%20Methods%20other%20than%20Text

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh that's great that Chakra has already have it! But the theme colour is difference so can you change it from blue to primary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I mentioned in the Slack channel, the 'dateTime-local' input type is not supported in some browsers (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local).

As an alternative, I used the React datetime picker (https://www.npmjs.com/package/react-datetime-picker).

I included styles in the TSX file to overwrite the default CSS and tailor the calendar to our color theme.

Screen.Recording.2023-12-29.at.15.57.03.mov

<Box
{...getRootProps()}
textAlign="center"
mt={{ base: '30px', md: '40px' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bedore uploading images, I think this space is too much 👀

Copy link
Contributor Author

@SachiGoto SachiGoto Dec 15, 2023

Choose a reason for hiding this comment

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

I added margin only when there is at least one image, so it doesn't appear like there is too much space without images.

Suggested change
mt={{ base: '30px', md: '40px' }}
<Box
{...getRootProps()}
textAlign="center"
mt={selectedImages.length !== 0 && { base: '30px', md: '40px' }}
>
<PrimaryButton variant="outline">
<input {...getInputProps()} />
Add Image
</PrimaryButton>
</Box>
Screenshot 2023-12-12 at 6 02 32 PM Screenshot 2023-12-12 at 6 02 47 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

If you think about the consistency with the other form fields, it's better to have same margin top between label and form. So the other fields have 8px for margin top, the image also should have 8px. And I think it's better to align-left for consistency! The final pic is what I think ideal style.

Screenshot 2023-12-16 at 1 36 58 PM Screenshot 2023-12-16 at 1 37 17 PM Screenshot 2023-12-16 at 1 40 08 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I adjusted the spacing! I still added 40px margin bottom when images are inserted so there is good amount of space between the title and images.

Screenshot 2023-12-29 at 15 59 59 Screenshot 2023-12-29 at 16 00 33
Screenshot 2023-12-29 at 16 00 22 Screenshot 2023-12-29 at 16 00 27

Comment on lines 57 to 61
<Input
type="text"
placeholder="Asakusa Temple"
{...register('title')}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

For dark mode, I think it's hard to see the input components, so could you please change to like design? You can change in theme file or make input component if you think it's better to maintain!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much for pointing that out! I created InputForm and TextareaForm under the input components and added color for dark mode. Is it a good way?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you, it is good! But could you modify the theme colour from blue to primary? You can do like search input, or you can change it in theme file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added primary.600 for focus border color
Screenshot 2023-12-29 at 16 12 53

@@ -0,0 +1,17 @@
import { zodResolver } from '@hookform/resolvers/zod'
Copy link
Contributor

Choose a reason for hiding this comment

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

schema is not component directory! You can make schema directory

import {Form} from "./components"


export default function Create() {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to name like CreateActivityPage which is more clear!

@SachiGoto SachiGoto merged commit e13401e into main Jan 11, 2024
2 checks passed
@SachiGoto SachiGoto deleted the activity-create branch January 11, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants