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

Add basic shell for Vault view #23

Merged
merged 8 commits into from
Apr 13, 2023
Merged

Add basic shell for Vault view #23

merged 8 commits into from
Apr 13, 2023

Conversation

DavidCorrea
Copy link
Collaborator

Reviewer Details

This PR addresses the basic shell for where the File Tree and the folder content will be displayed.

Items Addressed

Out of scope

  • Any navigational functionality
  • Selecting a file within the folder
  • Fetching files from back end (just display hard-coded file metadata for now)

Code Review Questions

  • On my understanding, the ticket was referring to having the two containers where all the information will be displayed. How it would be displayed sounded like it was going to be addressed in other ticket. I might have understood wrong, will implement missing part when I come back of OOO if so.
  • Please see my own comments in the code as I have questions there too.

Author Checklist

  • Review the diff and ensure all changes are relevant, intentional, and address all in-scope requirements
  • Assign a dev reviewer when you're ready for code review

@DavidCorrea DavidCorrea self-assigned this Apr 7, 2023
Comment on lines 29 to 31
<Header />
<main id="main-content">{children}</main>
<Footer />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❓ - Do we want to keep the Header and Footer while they're not implemented yet?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I vote for removing the header and footer until we have them designed and implemented!

@@ -22,13 +22,13 @@ function Layout({ flashMessages, pathname, children }) {
scrollToTop()
}, [pathname])
return (
<div>
<div style={{ height: '100%' }}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ - Totally dislike inlining styles, but I'm not sure how we want to approach having the app being full height. Do we use any library for that in other projects or do we do it on our own?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@DavidCorrea will this still be needed when the header and footer are eventually designed and added back in?

I'm a little ignorant on CSS practices...can we keep this 100% height but move it to the stylesheet?

<Header />
<main id="main-content">{children}</main>
<Footer />
<main id="main-content" style={{ height: '100%' }}>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ - See comment in this line.


function FileTree({ folders }) {
return (
<aside className="vault__file-tree">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

❓ - How do we want to approach CSS classes names? Do we want to use BEM? Any other convention?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are used to using BEM, I'd be good with that.

I'd defer to @ambernardi on this. Analisa, do you have any preferences on class naming conventions?

I think the two of you will be handling most of the styling, so I'm good with whatever y'all choose!

Copy link
Collaborator

Choose a reason for hiding this comment

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

At the risk of proposing an additional technology, CSS Modules provides unique classnames without the developer-knowledge-overhead and eventually frequent structural updates required of BEM classes. Just an idea; not a hill I would die on.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I should note that styled-components also provides the same benefits listed above, but it's incredibly slow (it relies on extensive amounts of JS at runtime) and I've seen it abused in two different companies, so I can't recommend it.

import exact from 'prop-types-exact'

const propTypes = {
content: PropTypes.array.isRequired,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

💭 - Used content here, but mostly as a placeholder, it could be renamed to something more appropiate.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a tough one to name...

Maybe "items"? Still generic, but "content" makes me think it would be full of text.

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 like items! Wanted something that could represent both files and folders but couldn't come up with anything. Items is perfect.

Comment on lines 12 to 47
const fileTree = {
repository: 'Vault',
folders: [
{
id: 1,
parentFolderId: null,
createdAt: '2023-03-11 20:49:53.911774',
updatedAt: '2023-03-19 20:49:53.911774',
repository: 'Vault',
name: 'Northeast Vault',
childrenCount: 3,
path: '/Vault/Northeast Vault',
},
{
id: 2,
parentFolderId: null,
createdAt: '2023-03-11 20:49:53.911774',
updatedAt: '2023-03-19 20:49:53.911774',
repository: 'Vault',
name: 'West Coast Vault',
childrenCount: 0,
path: '/Vault/West Coast Vault',
},
],
files: [],
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

💭 - As mentioned in the ticket, we're hardcoding this for now.

Comment on lines +42 to +43
html,
body,
#root {
height: 100vh;
margin: 0;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

⚠️ - See comment in this line.

@nicoledow nicoledow self-requested a review April 7, 2023 21:52
Comment on lines 29 to 31
<Header />
<main id="main-content">{children}</main>
<Footer />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I vote for removing the header and footer until we have them designed and implemented!

import exact from 'prop-types-exact'

const propTypes = {
content: PropTypes.array.isRequired,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a tough one to name...

Maybe "items"? Still generic, but "content" makes me think it would be full of text.


const defaultProps = {}

function FolderView({ content }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a name like "FolderContents" might be more appropriate for this component? "FolderView" makes me think it's a view 🤔

@@ -22,13 +22,13 @@ function Layout({ flashMessages, pathname, children }) {
scrollToTop()
}, [pathname])
return (
<div>
<div style={{ height: '100%' }}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DavidCorrea will this still be needed when the header and footer are eventually designed and added back in?

I'm a little ignorant on CSS practices...can we keep this 100% height but move it to the stylesheet?


function FileTree({ folders }) {
return (
<aside className="vault__file-tree">
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are used to using BEM, I'd be good with that.

I'd defer to @ambernardi on this. Analisa, do you have any preferences on class naming conventions?

I think the two of you will be handling most of the styling, so I'm good with whatever y'all choose!

repository: 'Vault',
folders: [
{
id: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll update this in the docs (sorry!), but the id fields will now be uuid strings instead of integers.

import exact from 'prop-types-exact'

const propTypes = {
folders: PropTypes.array.isRequired,
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add the prop shape to types.json and make this PropTypes.arrayOf(Types.folder)?

import exact from 'prop-types-exact'

const propTypes = {
content: PropTypes.array.isRequired,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment here as above, can we add a file shape to types.json and make this line PropTypes.arrayOf(Types.file).isRequired?

return (
<div className="vault__folder-view">
{content.map((folderOrFile, index) => {
return <div key={index}>{folderOrFile}</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

key should ideally be an identifying attribute that's truly unique, as using an array item's index can cause bugs if the sort order changes.

https://react.dev/learn/tutorial-tic-tac-toe#picking-a-key

Copy link
Collaborator

@nicoledow nicoledow left a comment

Choose a reason for hiding this comment

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

Looking awesome! Just wanted to rename a couple things after we learned some details about the Vault/ExhibitShare being combined in one toggle-able view. After we rename those I think we'll be good to go!


const defaultProps = {}

function Vault() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

After talking to Analisa about design plans, it sounds like Vault and ExhibitShare will be one page on which you can toggle between views.

Knowing that, maybe we rename this view? Maybe Library.js?

@@ -17,6 +18,9 @@ function Routes() {
<Route path="/styleguide">
<StyleguideRoutes />
</Route>
<Route path="/vault">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to other comment, maybe we make this /library and rename the routes LibraryRoutes?

items: PropTypes.oneOfType([
PropTypes.arrayOf(Types.folder).isRequired,
PropTypes.arrayOf(Types.file).isRequired,
]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small refactor possibility would be to extract an Types.item type, which would be either a Types.folder or Types.file, as I'd imagine this union entity will appear in other places in the front-end app over time.

Comment on lines 39 to 40
// Styles for Assistive Technologies (keep these last!)
@import 'components/visually-hidden';
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DavidCorrea I think this line and its associated comment should be kept at the very bottom of the file to avoid being inadvertently overwritten as this file grows.

Copy link
Collaborator

@nicoledow nicoledow left a comment

Choose a reason for hiding this comment

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

One small request to update an key, but looks good to go! Nice work!

<aside className="library__file-tree">
{folders.map((folder, index) => {
return (
<div className="folder" key={index}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we update the key here to be folder.id?

@nicoledow nicoledow merged commit 4086b2c into main Apr 13, 2023
@nicoledow nicoledow deleted the vault-basic-shell branch April 13, 2023 20:25
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