Skip to content

Generate a two-word project name #184

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

Merged
merged 6 commits into from
Nov 16, 2016
Merged

Generate a two-word project name #184

merged 6 commits into from
Nov 16, 2016

Conversation

kaganjd
Copy link
Collaborator

@kaganjd kaganjd commented Nov 4, 2016

Closes #101
screen shot 2016-11-03 at 9 33 13 pm

@kaganjd kaganjd changed the title Generates a two-word project name Generate a two-word project name Nov 4, 2016
@@ -1,7 +1,10 @@
import * as ActionTypes from '../../../constants';
const generate = require('project-name-generator');
Copy link
Member

Choose a reason for hiding this comment

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

To ES6-ify this line:

import generate from 'project-name-generator';


const initialState = {
name: 'Hello p5.js'
name: `${generatedName}`
Copy link
Member

Choose a reason for hiding this comment

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

You should move the function call into the initial state, i.e. change this to

const initialState = {
    name: `${generate({ words: 2}).dashed}`
};

As it is now, the following happens, which I think is a bug:

  1. User navigates to the editor and starts working on a project
  2. User saves the project.
  3. User clicks "New"
  4. The new project has the same name as the previous project.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i tried this and found that moving the function call doesn't fix the problem, i think because newProject() doesn't actually create a new project; it just returns the initialState name. this was fine when all new sketches had the same name. hmm, i'll have to think about this a little more... has there been discussion of "untitled" as the sketch name prior to saving? and then the generated name appears on save?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right! The way to make this work is to make initialState into a function rather than a variable. See the files reducer for an example of how to do this.

@catarak
Copy link
Member

catarak commented Nov 4, 2016

I'm not saying that I don't like it, but is there any reason you decided that the name should be dashed rather than spaced? I'm not sure that I have an opinion about it, just curious. Also, do you think that the first work should be capitalized? Am I thinking about this too hard?

@kaganjd
Copy link
Collaborator Author

kaganjd commented Nov 5, 2016

  1. i tried spaced and didn't like it because with 0 capitalized words, they just looked like words floating-- not a project name-- so i went with dashed instead.
  2. i think spaced with first word capitalized is a good idea. wdyt?
    screen shot 2016-11-05 at 10 40 26 am
  3. no.

@catarak
Copy link
Member

catarak commented Nov 7, 2016

I'm leaning towards first word capitalized + spaced rather than dashed, I think.

@catarak catarak force-pushed the master branch 2 times, most recently from 061c7c6 to 81475c0 Compare November 16, 2016 18:19
@catarak catarak merged commit 449e103 into processing:master Nov 16, 2016
@kaganjd kaganjd deleted the 101-name-generator branch May 30, 2017 19:35
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.

2 participants