-
Notifications
You must be signed in to change notification settings - Fork 881
feat: WorkspaceSection action #1623
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This PR is a squash of refactors and improvements in our Workspace and WorkspaceSection components. An action prop is added to WorkspaceSection and along the way, I refactored things that were not meeting conventions or were hard to read. With this addition, I am further unblocked in making auto-start/off editable in the UI, as I intend to use the Action prop to trigger a modal (or routed page view) with the form. Squashed commits: * refactor: spaces for readability It's hard to read HTMl markup without spaces on adjacent nodes * refactor: props Our components had unused props and arbitrary ordering.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,11 @@ import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection" | |
import { WorkspaceStatusBar } from "../WorkspaceStatusBar/WorkspaceStatusBar" | ||
|
||
export interface WorkspaceProps { | ||
organization?: TypesGen.Organization | ||
workspace: TypesGen.Workspace | ||
template?: TypesGen.Template | ||
handleStart: () => void | ||
handleStop: () => void | ||
handleRetry: () => void | ||
handleUpdate: () => void | ||
workspace: TypesGen.Workspace | ||
workspaceStatus: WorkspaceStatus | ||
builds?: TypesGen.WorkspaceBuild[] | ||
} | ||
|
@@ -24,11 +22,11 @@ export interface WorkspaceProps { | |
* Workspace is the top-level component for viewing an individual workspace | ||
*/ | ||
export const Workspace: React.FC<WorkspaceProps> = ({ | ||
workspace, | ||
handleStart, | ||
handleStop, | ||
handleRetry, | ||
handleUpdate, | ||
workspace, | ||
workspaceStatus, | ||
builds, | ||
}) => { | ||
|
@@ -45,19 +43,23 @@ export const Workspace: React.FC<WorkspaceProps> = ({ | |
handleUpdate={handleUpdate} | ||
workspaceStatus={workspaceStatus} | ||
/> | ||
|
||
<div className={styles.horizontal}> | ||
<div className={styles.sidebarContainer}> | ||
<WorkspaceSection title="Applications"> | ||
<Placeholder /> | ||
</WorkspaceSection> | ||
<WorkspaceSchedule workspace={workspace} /> | ||
|
||
<WorkspaceSection title="Dev URLs"> | ||
<Placeholder /> | ||
</WorkspaceSection> | ||
|
||
<WorkspaceSection title="Resources"> | ||
<Placeholder /> | ||
</WorkspaceSection> | ||
</div> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review: Will add this to FE V and search for lint rule. zero spaces in HTML markup makes me dizzy! |
||
<div className={styles.timelineContainer}> | ||
<WorkspaceSection title="Timeline" contentsProps={{ className: styles.timelineContents }}> | ||
<BuildsTable builds={builds} className={styles.timelineTable} /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import IconButton from "@material-ui/core/IconButton" | ||
import EditIcon from "@material-ui/icons/Edit" | ||
import { action } from "@storybook/addon-actions" | ||
import { Story } from "@storybook/react" | ||
import React from "react" | ||
import { WorkspaceSection, WorkspaceSectionProps } from "./WorkspaceSection" | ||
|
||
export default { | ||
title: "components/WorkspaceSection", | ||
component: WorkspaceSection, | ||
} | ||
|
||
const Template: Story<WorkspaceSectionProps> = (args) => <WorkspaceSection {...args}>Content</WorkspaceSection> | ||
|
||
export const NoAction = Template.bind({}) | ||
NoAction.args = { | ||
title: "A Workspace Section", | ||
} | ||
|
||
export const Action = Template.bind({}) | ||
Action.args = { | ||
action: ( | ||
<IconButton onClick={action("edit")}> | ||
<EditIcon /> | ||
</IconButton> | ||
), | ||
title: "Action Section", | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review: We forgot to add this story additionally, but now it's here and with two examples. I couldn't think of an example for |
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.
Review:
oraganization
andtemplate
were unused (note this is one caveat when a prop is optional, we don't really know if we're even using it. I wonder if there's a lint rule that can help with that, but suffice it to say I just checked which of these the component was de-structuring. Also this is why de-structuringprops
is superior to theprop
arg...it's helpful to see where everything is being used with a simple find/replace).