Skip to content

Commit

Permalink
PagesEditor: split WorkflowHeader into WorkflowTopLinks and WorkflowTabs
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunanoordin committed Jan 8, 2025
1 parent 2bc7dc9 commit 4d513c8
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 23 deletions.
17 changes: 13 additions & 4 deletions app/pages/lab-pages-editor/PagesEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { StrictMode, useState } from 'react';
import PropTypes from 'prop-types';

import DataManager from './DataManager.jsx';
import WorkflowHeader from './components/WorkflowHeader.jsx';
import WorkflowTabs from './components/WorkflowTabs.jsx';
import WorkflowTopLinks from './components/WorkflowTopLinks.jsx';
import TasksPage from './components/TasksPage';
import WorkflowSettingsPage from './components/WorkflowSettingsPage';
import strings from './strings.json';
Expand All @@ -31,11 +32,11 @@ function PagesEditor({ params }) {
const tabs = [
{
id: 'pages-editor_workflow-header-tab-button_task',
label: strings.PagesEditor.components.WorkflowHeader.tasks,
label: strings.PagesEditor.components.WorkflowTabs.tasks,
targetPanel: 'pages-editor_tab-panel_task'
}, {
id: 'pages-editor_workflow-header-tab-button_settings',
label: strings.PagesEditor.components.WorkflowHeader.workflow_settings,
label: strings.PagesEditor.components.WorkflowTabs.workflow_settings,
targetPanel: 'pages-editor_tab-panel_settings'
}
];
Expand All @@ -48,12 +49,20 @@ function PagesEditor({ params }) {
projectId={projectId}
workflowId={workflowId}
>
<WorkflowHeader
<WorkflowTopLinks
currentTab={currentTab}
projectId={projectId}
setCurrentTab={setCurrentTab}
tabs={tabs}
/>
{/*
<WorkflowTabs
currentTab={currentTab}
projectId={projectId}
setCurrentTab={setCurrentTab}
tabs={tabs}
/>
*/}
{(currentTab === 0) && (
<div
aria-labelledby={tabs[0].id}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions app/pages/lab-pages-editor/components/WorkflowTopLinks.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import ExternalLinkIcon from '../icons/ExternalLinkIcon.jsx';
import ReturnIcon from '../icons/ReturnIcon.jsx';
import { useWorkflowContext } from '../context.js';
import strings from '../strings.json';
import zooniverseLogo from '../assets/zooniverse-word-white.png'

const DEFAULT_HANDLER = () => {};

export default function WorkflowTopLinks() {
const { project, workflow } = useWorkflowContext();
const returnUrl = `/lab/${project?.id}/workflows`;

if (!project || !workflow) return null;

return (
<div className="workflow-top-links">
<a href={returnUrl}> {/* Formerly <Link> from 'react-router', but React was throwing Legacy Context errors. */}
<ReturnIcon />
{strings.PagesEditor.components.WorkflowTopLinks.return}
</a>
<span className="flex-item" />
<img className="zooniverse-logo" src={zooniverseLogo} />
</div>
);
}
6 changes: 4 additions & 2 deletions app/pages/lab-pages-editor/strings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"PagesEditor": {
"components": {
"WorkflowHeader": {
"return": "Back to Workflows",
"WorkflowTabs": {
"tasks": "Tasks",
"workflow_settings": "Workflow Settings"
},
"WorkflowTopLinks": {
"return": "Back to Workflows"
}
}
}
Expand Down
38 changes: 21 additions & 17 deletions css/lab-pages-editor.styl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ $fontWeightBoldPlus = 700
font-family: $fontFamilies
font-size: $fontSizeM
margin: 0 auto
padding: $sizeM $sizeM

// General UI
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -187,30 +186,35 @@ $fontWeightBoldPlus = 700
.workflow-version
color: $teal

// Component: Workflow Header
// Component: Workflow Top Links and Workflow Tabs
// Formerly grouped as "Workflow Header"
// ---------------------------------------------------------------------------

.workflow-header
margin-bottom: $sizeXL
.workflow-top-links
flex-row()
background: $teal
color: $white
margin-bottom: $sizeM
padding: $sizeS

a
display: inline-block
color: $white
font-size: $fontSizeS
text-decoration: none
min-width: 40%

.workflow-header-top
flex-row()
background: $teal
color: $white
margin-bottom: $sizeM
padding: $sizeXS
.icon
margin-right: $sizeS

.zooniverse-logo
max-width: 160px

a
display: inline-block
color: $white
font-size: $fontSizeS
text-decoration: none
.workflow-header
margin-bottom: $sizeXL

.icon
margin-right: $sizeS
a
min-width: 40%

.workflow-header-tabs
main-content()
Expand Down

0 comments on commit 4d513c8

Please sign in to comment.