-
Notifications
You must be signed in to change notification settings - Fork 27
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
Simple UI #16
Simple UI #16
Conversation
Signed-off-by: Carlos Martín <[email protected]>
Signed-off-by: Carlos Martín <[email protected]>
New api.js based on https://github.com/src-d/code-annotation/blob/master/src/api/index.js Signed-off-by: Carlos Martín <[email protected]>
frontend/src/App.js
Outdated
@@ -44,6 +44,13 @@ GROUP BY committer_email, month, repo_id`, | |||
} | |||
|
|||
render() { | |||
let ok; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow. why not
const ok = this.state.response && this.state.response.status === 200
?
try-catch isn't very javascript way to do such things.
or even better:
const { response } = this.state;
const ok = response && response.status === 200;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one comment above. In general ok.
Maybe I wouldn't include debug textarea in PR, you can easily see the response in dev tools. But up to you.
👍 for moving step by step. No need redux at this stage.
Signed-off-by: Carlos Martín <[email protected]>
9e5c407
to
c5eac76
Compare
btw do I understand right that you are going to implement proper layout, loading and error state in separate PRs? According to the issue, I would expect it. |
Of course that's needed, but my understanding from the design doc is that issue #4 (alpha 1 milestone) would only include the most basic UI (as is in this PR), and those things you list would be added for alpha 2, new issues. ping @bzz for clarification. |
I would better go with simple but complete UI in alpha0. Like there are still only 2 blocks (input and table), but they fill the whole page in the wireframe. Error replaces table as in the wireframe and so on. But yeah. Up to @bzz. |
For me, it would be totally fine to expect proper error placement and further enhancement of current components as part of the alpha2 as Carlos suggests, for the reason of getting a really minimal alpha1 faster to the staging env. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
GUI looks great. BTW if we already have table, may be we do not need to print JSON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow! I liked!! And it worked in my PC...
But since the goal of this PR was to start the structure, and we agreed on to try following cat
one if possible, I have some doubts and some issues that imho should be addressed.
}, | ||
plugins: ['import', 'react', 'jest', 'prettier'], | ||
rules: { | ||
'prettier/prettier': 'error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparing with cat
, why not adding?
'prettier/prettier': ['error', { singleQuote: true, trailingComma: 'es5' }],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that replaces .prettierrc
, it doesn't make sense to have both, so I removed it.
'import/no-unresolved': 0, | ||
'import/extensions': 0, | ||
'func-names': 0, | ||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss other rules from cat
'no-underscore-dangle': 0, // because of _super
'react/prop-types': 0,
'no-console': ['error', { allow: ['info', 'warn', 'error'] }], // later we will might need wrapper
why not adding them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the conversation in https://github.com/src-d/company/pull/127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't found agreement about 'no-console' conf; did you?
Are we accepting console
things?
Why not using a wrapper as in CAT
?
/node_modules | ||
|
||
# testing | ||
/coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really needed for the front? it's already in the main .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gitignore is the create-react-app default. If we see this dir as a kind of sub-project I think it makes sense to leave this .gitignore
here for frontend-only files.
Plust the rules in the .gitignore
in master do not apply here, instead of /node_modules
it should be frontend/node_modules
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the folder is like a "subproject"...
I use to like small .gitignore
files... with as fewer rules as possible, so I like the idea of avoiding duplicities; anyhow this is more like an opinion, so if you do not share it, feel free to disregard it 🗡️
About node_modules
rule:
if it should be in the main .gitignore
it should be frontend/node_modules
but since it makes sense to be in the frontend/.gitignore
it needs to relative to the frontend
dir.
/coverage | ||
|
||
# production | ||
/build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not needed by the front... it's already in main .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please keep the conversation in one thread, above.
/build | ||
|
||
# misc | ||
.DS_Store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this misc
ones, with .DS_Store
and .env.*
are already in the main .gitignore
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if we use the cat
favicon instead of the react one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3d57d81.
frontend/public/manifest.json
Outdated
@@ -0,0 +1,15 @@ | |||
{ | |||
"short_name": "React App", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the gitbase-playground values 💃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3d57d81.
frontend/src/index.js
Outdated
import 'bootstrap/dist/css/bootstrap.css'; | ||
import 'bootstrap/dist/css/bootstrap-theme.css'; | ||
import './override.less'; | ||
import './index.css'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we write only .less
code, as in cat
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would skip this and merge as it is. All the machinery to write less
is in place, this file can be changed at any moment when we start to write styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3d57d81.
if (json.errors) { | ||
throw json.errors; | ||
} | ||
return json; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the data will be always under a data
field; why not returning it as done in cat
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, for this project we have data
and meta
.
@@ -0,0 +1,82 @@ | |||
function checkStatus(resp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not moving this service into its own place?
In cat
we used /api
package, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the benefit of moving api.js
to /api/index.js
? I don't have a strong opinion on this, let me know why and we can move it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two reasons;
first one is kindof opinionated: imo the root dir should be populated with as fewer things as possible because it helps to understand better the structure of the code.
second one is generic: now we have in this file the logic (copy-pasted from cat
) to connect with the API (business agnostic), and also the "repository-like" code (business related). Splitting both parts properly, and moving business agnostic to a service, and the business logic to a repository would help us to reuse and test better.
Signed-off-by: Carlos Martín <[email protected]>
@dpordomingo please take another look when you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The only missing things I see are the following ones, that imho shouldn't block this merge since they could be addressed in further iterations.
- log: Simple UI #16 (comment)
- gitignore: Simple UI #16 (comment)
- api: Simple UI #16 (comment)
Since you're the maintainer, let me know if I can/should open issues for any of them that you think we could consider in next iterations, and I'll happily do so to avoid forgetting it.
Thank you for your comments. I agree, those details can be discussed in new issues and changed later on without much difficulty. Please fell free to open any new issues. Let's merge so we can move forward with the building and release tasks. |
Part of #4.
This is a simple first version for the UI. A few notes:
/public
. But I find it a bit strange, because the fronted actually has a sub-dir namedpublic
for some files. I this PR I propose/frontend
, but this can be easily changed.