Skip to content

Commit

Permalink
Merge pull request #459 from NBISweden/dev/help-page
Browse files Browse the repository at this point in the history
Add help page
  • Loading branch information
HenrikeW authored May 19, 2022
2 parents 704215d + 4d72b21 commit 9a8ce04
Show file tree
Hide file tree
Showing 8 changed files with 261 additions and 3 deletions.
9 changes: 9 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import { Login } from "./pages/Login";
import { Report } from "./pages/Report";
import { Help } from "./pages/Help";
import { AuthProvider } from "./components/AuthProvider";
import { ProtectedRoute } from "./components/ProtectedRoute";
import { getISOWeek } from "date-fns";
Expand Down Expand Up @@ -39,6 +40,14 @@ export const App = () => {
/>
}
/>
<Route
path="/help"
element={
<ProtectedRoute>
<Help />
</ProtectedRoute>
}
/>
</Routes>
</AuthProvider>
</BrowserRouter>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/HeaderUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export const HeaderUser = ({ username }: { username: string }) => {
return (
<ul className="settings-box" aria-labelledby="dropdownMenuLink">
<li className="settings-list-item">
<a className="dropdown-item settings-list-link" href="/report">
Report time
</a>
<a className="dropdown-item settings-list-link" href="/help">
Help
</a>
<a className="dropdown-item settings-list-link" onClick={logout}>
Logout
</a>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/QuickAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const QuickAdd = ({

return (
<div className="row">
<h2> Add a new issue</h2>
<h2> Add a new row</h2>
<input
aria-labelledby="input-issue"
id="input-issue"
Expand Down
Binary file added frontend/src/icons/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/icons/weektravel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 45 additions & 1 deletion frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Other button classes are defined further down together with other classes for th
}
/* stylelint-enable selector-class-pattern */

.report-header {
.usr-header {
display: flex;
justify-content: space-between;
align-items: center;
Expand Down Expand Up @@ -565,3 +565,47 @@ Other button classes are defined further down together with other classes for th
z-index: 101;
overflow: hidden;
}

.help-wrapper {
background-color: hsl(0deg 0% 97%);
padding: 0 3rem 3rem;
position: relative;
margin: 100px 0;
}

.help-title {
font-size: 2rem;
margin-top: 1.5rem;
margin-left: 2rem;
color: hsl(186deg 92% 11%);
}

.help-subtitle {
font-size: 1.5rem;
margin-top: 1.5rem;
color: hsl(186deg 92% 11%);
}

.help-info {
font-size: 1.2rem;
margin-top: 1.5rem;
}

.overview-img {
height: 30rem;
width: 65rem;
margin-right: 1rem;
margin-top: 2rem;
}

.weektravel-img {
height: 25rem;
width: 27rem;
margin-right: 1rem;
margin-top: 2rem;
}

.centered {
display: flex;
justify-content: center;
}
199 changes: 199 additions & 0 deletions frontend/src/pages/Help.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
import "../index.css";
import React from "react";
import { AuthContext } from "../components/AuthProvider";
import { HeaderUser } from "../components/HeaderUser";
import { Row } from "../components/Row";
import { Cell } from "../components/Cell";
import { IssueActivityPair, FetchedTimeEntry } from "../model";
import { QuickAdd } from "../components/QuickAdd";
import weektravel from "../icons/weektravel.png";
import overview from "../icons/overview.png";

export const Help = () => {
const context = React.useContext(AuthContext);
const exampleIAP: IssueActivityPair = {
activity: {
id: 1,
name: "Test activity",
},
issue: {
id: 1,
subject: "Test issue",
},
custom_name: "Test custom name",
is_hidden: false,
};
const exampleEntry: FetchedTimeEntry = {
id: 1,
project: {
id: 1,
name: "Test project",
},
issue: {
id: 1,
},
user: {
id: 1,
name: "Test user",
},
activity: {
id: 1,
name: "Test activity",
},
hours: 1,
comments: "Test comments",
spent_on: "2020-01-01",
created_on: "2020-01-01",
updated_on: "2020-01-01",
};
return (
<main>
<div className="usr-header">
<h1 className="help-title">How do I use the urdr service?</h1>
<HeaderUser username={context.user ? context.user.login : ""} />
</div>
<div className="help-wrapper">
<h2 className="help-subtitle">Introduction</h2>
<p className="help-info">
The purpose of this website is to ease the process of logging time on
the
<a href="https://projects.nbis.se"> NBIS Redmine instance</a>. The
usual procedure for logging time with Redmine involves selecting an
issue and an activity for reporting your time. In urdr, issues are
strictly linked to valid activities, thus making it simpler to do time
reporting accurately. The time reporting page offers a
spreadsheet-like grid for time entry reporting, together with the
possibility to navigate over different weeks. The report view is
primarily made up of a header containing a date picker and arrow
buttons to navigate between weeks, as well as a user dropdown menu.
Below, you find the time entries grid, and the bottom bar including
the feature for adding new rows and saving your changes.
</p>
<div className="centered">
<img src={overview} alt="overview of urdr" className="overview-img" />
</div>
<h2 className="help-subtitle">What is a row?</h2>
<p className="help-info">
Within the context of the urdr system, we refer to a row as to the
visual element on the page where the time entries of a given
issue-acivity pair are displayed for one specific week. There are two
types of rows: favourite and recent rows.
</p>
<h2 className="help-subtitle">Favourite and recent rows</h2>
<p className="help-info">
The following row has been marked as favourite so it will always
appear at the top of the list. Rows are marked as favourite /
non-favourite after clicking on the star button present next to the
title of the corresponding issue. It's worth noting that favourite
rows are saved across sessions. Moreover, the order of the favourite
rows can be changed by drag and dropping the row using the
drag–and–drop handle icon at the left-most position of the row.
</p>
<Row
topic={exampleIAP}
days={[new Date()]}
rowHours={[1]}
rowEntries={[exampleEntry]}
getRowSum={() => 1}
onHide={() => {}}
isFav={true}
onToggleFav={() => {}}
onCellUpdate={() => {}}
></Row>
<p className="help-info">
The next one is a recent row. The issues shown here are the ones you
have most recently logged time on, based on the week you are currently
looking at. Thus, recent rows change as you navigate across different
weeks or as you add new time entries. If desired, these type of rows
can be hidden after clicking on the eye button.
</p>
<Row
topic={exampleIAP}
days={[new Date()]}
rowHours={[1]}
rowEntries={[exampleEntry]}
getRowSum={() => 1}
onHide={() => {}}
isFav={false}
onToggleFav={() => {}}
onCellUpdate={() => {}}
></Row>
<h2 className="help-subtitle">Adding new rows</h2>
<p className="help-info">
In order to add a new row, it is necessary to first enter a valid
issue number and then select an activity, which will be linked to the
issue. After clicking on the plus button, a new row will be appended
to the bottom of the list of recent rows.
</p>
<p className="help-info">
A cell in the sum row shows the sum of all time entries logged on
different rows on the corresponding day. It is worth noting that the
sum also contains entries that have been hidden from list of recent
rows. In case the number displayed in a sum field doesn't seem to fit
to the time entries displayed above, you have probably hidden a row
that contained a time entry for that day. You can easily make it
visible again by using the <b>"Add new row"</b> feature.
</p>
<QuickAdd addIssueActivity={() => {}}></QuickAdd>
<h2 className="help-subtitle">Adding or updating time entries</h2>
<p className="help-info">
One may log time by simply clicking on the cell corresponding to the
desired date. If the cell is emptied, the underlying time entry will
be deleted. It's of course also possible to update existing values of
a cell. All changes made to a cell are saved only after clicking on
the <b>"Save Changes"</b> button.
</p>
<p className="help-info">
It is also possible to add a comment to a time entry by clicking on
the triangle present at the top right of a cell. The color of this
icon is grey when a comment has not been saved yet:
</p>
<div className="centered">
<Cell
topic={exampleIAP}
date={new Date()}
hours={1}
comments={""}
entryId={1}
onCellUpdate={() => {}}
/>
</div>
<p className="help-info">
However, once the comment has been saved along with the time entry,
the triangle turns black:
</p>
<div className="centered">
<Cell
topic={exampleIAP}
date={new Date()}
hours={1}
comments={"Test comment"}
entryId={1}
onCellUpdate={() => {}}
/>
</div>
<h2 className="help-subtitle">Time travelling</h2>
<p className="help-info">
Users can navigate across different weeks by using the left and right
arrow or using the week picker. The week picker is displayed after
clicking on the button containing a calendar icon and the current week
number. It's worth noting that users can also go back to previously
visited weeks by using the browser's back button.
</p>
<p className="help-info">
The URL displayed in your browser will show which year and week you
are currently looking at. That makes it possible to note down a link
to a certain week in urdr, in case you know you want to revisit that
week at a later point.
</p>
<div className="centered">
<img
src={weektravel}
alt="time travelling calendar"
className="weektravel-img"
/>
</div>
</div>
</main>
);
};
2 changes: 1 addition & 1 deletion frontend/src/pages/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export const Report = () => {
}
>
<header>
<div className="report-header">
<div className="usr-header">
<h1 className="header-year">
{getISOWeekYear(weekTravelDay).toString()}
</h1>
Expand Down

0 comments on commit 9a8ce04

Please sign in to comment.