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

Autogenerated filename #127

Merged
merged 13 commits into from
Feb 10, 2024
Merged

Conversation

AsynchronousAI
Copy link
Contributor

#97

Copy link

vercel bot commented Jan 18, 2024

@AsynchronousAI is attempting to deploy a commit to the CP Initiative Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@thecodingwizard thecodingwizard left a comment

Choose a reason for hiding this comment

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

nice! a couple minor things:

  • placeholder should be applied to the input, not to the label
  • right now, every rerender will change the placeholder. maybe make defaultFileName a state, and add a useEffect to set the default file name once when the component is mounted.
  • you'll need to modify the handleSubmit function to use the defaultFileName if fileName is an empty string.

@AsynchronousAI
Copy link
Contributor Author

  • placeholder should be applied to the input, not to the label

That's my bad, sorry.

  • right now, every rerender will change the placeholder. maybe make defaultFileName a state, and add a useEffect to set the default file name once when the component is mounted.
  • you'll need to modify the handleSubmit function to use the defaultFileName if fileName is an empty string.

I switched everything to set the fileName state to a random fileName rather than having it directly display random so it should fix these 2 issues.

@AsynchronousAI
Copy link
Contributor Author

Also I was having trouble with npm run dev is there a setup guide?

@thecodingwizard
Copy link
Member

Instructions are here, though they're not that thorough: https://github.com/cpinitiative/ide?tab=readme-ov-file#running-locally

What issue were you having?

pages/new.tsx Outdated Show resolved Hide resolved
@AsynchronousAI
Copy link
Contributor Author

Instructions are here, though they're not that thorough: https://github.com/cpinitiative/ide?tab=readme-ov-file#running-locally

What issue were you having?

My server was incorrectly setup.

Copy link

vercel bot commented Jan 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 10, 2024 8:38pm

Copy link
Member

@thecodingwizard thecodingwizard left a comment

Choose a reason for hiding this comment

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

I think it may make more sense to move src/fileName.ts to src/scripts/generateRandomFileNamets, keep it as export default generateRandomFileName, and change the import to not have the curly braces (ie. import generateRandomFileName from .... Open to other ideas though!

To get the current code working, you have to remove "default" from the "export default ...". Or, remove the curly braces from import { generateRandomFileName }.

Thanks for making this PR!

@AsynchronousAI
Copy link
Contributor Author

I think it may make more sense to move src/fileName.ts to src/scripts/generateRandomFileNamets, keep it as export default generateRandomFileName, and change the import to not have the curly braces (ie. import generateRandomFileName from .... Open to other ideas though!

To get the current code working, you have to remove "default" from the "export default ...". Or, remove the curly braces from import { generateRandomFileName }.

Thanks for making this PR!

I made it so that the file name generator is in the new.tsx file itself just to avoid file abundance, I also only added like 15 adjetives and 15 nouns so the file doesn't get too large.

@thecodingwizard
Copy link
Member

thecodingwizard commented Jan 26, 2024

Hmm, I think after the auto-formatter makes every word its own line, it can get kind of big (and potentially we may want to add more words later). It might still be better to move it to a separate file outside of new.tsx?

(Sorry for making so many requested changes 😅)

@AsynchronousAI
Copy link
Contributor Author

AsynchronousAI commented Jan 29, 2024

Hmm, I think after the auto-formatter makes every word its own line, it can get kind of big (and potentially we may want to add more words later). It might still be better to move it to a separate file outside of new.tsx?

Fixed, I used src/scripts/generateFileName.ts.

(Sorry for making so many requested changes 😅)

No problem!

pages/new.tsx Outdated Show resolved Hide resolved
AsynchronousAI and others added 2 commits February 1, 2024 17:27
Co-authored-by: Nathan Wang <nathan.r.wang@gmail.com>
@AsynchronousAI
Copy link
Contributor Author

@thecodingwizard?

@danielzsh
Copy link
Member

Make sure to re-request reviews after implementing changes, with the little gray cycle button 😅
image

Copy link
Member

@thecodingwizard thecodingwizard left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, completely missed this 😰 . lgtm other than one minor fix. Thanks!

pages/new.tsx Outdated Show resolved Hide resolved
AsynchronousAI and others added 2 commits February 10, 2024 13:23
Co-authored-by: Nathan Wang <nathan.r.wang@gmail.com>
@thecodingwizard
Copy link
Member

lgtm if ci checks pass!

@AsynchronousAI
Copy link
Contributor Author

Screenshot 2024-02-10 at 5 06 10 PM

Tested it out also here, it works.

@thecodingwizard thecodingwizard merged commit d1a84d8 into cpinitiative:master Feb 10, 2024
2 checks passed
@thecodingwizard
Copy link
Member

Awesome, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants