Skip to content

Commit

Permalink
Merge pull request #110 from uselagoon/lagoon-tour-with-transitions
Browse files Browse the repository at this point in the history
Lagoon tour with transitions
  • Loading branch information
tobybellwood authored Apr 4, 2023
2 parents 57f0dd0 + 5a808f4 commit 324b24e
Show file tree
Hide file tree
Showing 63 changed files with 3,109 additions and 786 deletions.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,49 @@ In this example, we load two elements, a JS script and a css file into the `head
{"type": "script", "location":"https://www.cornify.com/js/cornify.js"}
]
}
```
```

## Tours configuration

The `tour.json` file contains configuration for the tour of the Lagoon app. it has the following structure:

```
{
"mode": "direct",
"routes": [
{
"pathName": "/projects",
"steps": [
{
"target":".someclass",
"title:": "title of the tour step",
"content": "description of the tour step",
}
...
]
}
...
]
}
```
> Note: The sequence of routes is self paced, meaning the users see information once as they traverse the app in an explanatory way
Tour steps use content hashes as keys, so if `content` or `title` changes, or a new step is added, the tour will automatically show it to the user.

> Make sure to run this command after updating the tour.json step contents.
```sh
yarn run generateTourHash
```

### Tour properties

- `mode` (string) - "translated" or "direct", if the value is "translated", `content` and `title` will be used as keys for lookup in the translation file, otherwise directly used.
- `routes` (array) - Array of objects, each describing a steps in the tour per route.
- `pathName` (string) - route.
- `target` (string) - css selector for the tour step.
- `content` (string) - This property is used based on the `mode` property, acts as the tour step body.
- `title` (string) - Similar to content, only acts as the header for the tour step.
- `key` (string) - identifier of steps per route, needs to be unique for each object in the `steps` array, generated by running `yarn run generateTourHash`.
- `placement` (string) (optional) - tooltip placement defined in react-joyride [docs](https://docs.react-joyride.com/step)
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ x-environment: &default-environment
LAGOON_ENVIRONMENT_TYPE: production
GRAPHQL_API: "${GRAPHQL_API:-http://localhost:3000/graphql}"
KEYCLOAK_API: "${KEYCLOAK_API:-http://localhost:8088/auth}"
LAGOON_UI_TOURS_ENABLED: enabled

services:
ui:
Expand Down
24 changes: 15 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "tsc && eslint -- src/",
"build": "next build src",
"start": "NODE_ENV=production node server.js",
"generateTourHash": "node tourHash.js",
"storybook": "start-storybook -s ./src -p 6006",
"build-storybook": "build-storybook -s ./src",
"serve-storybook": "storybook-server -s ./src"
Expand All @@ -26,12 +27,14 @@
"apollo-link-ws": "^1.0.10",
"babel-plugin-styled-components": "^2.0.7",
"colors": "^1.4.0",
"crypto-js": "^4.1.1",
"d3": "^5.15.0",
"date-fns": "^2.9.0",
"dotenv-extended": "^2.2.0",
"eslint": "^8.35.0",
"eslint-config-next": "^13.2.3",
"express": "^4.18.1",
"framer-motion": "^10.2.4",
"git-up": "^7.0.0",
"git-url-parse": "13.1.0",
"graphql": "^14.5.8",
Expand All @@ -40,6 +43,7 @@
"moment": "^2.22.2",
"moment-duration-format": "^2.2.2",
"next": "12",
"nprogress": "^0.2.0",
"object-hash": "^3.0.0",
"parse-url": "^8.1.0",
"postcss-nested": "^3.0.0",
Expand All @@ -51,6 +55,8 @@
"react-dom": "18.2.0",
"react-hexgrid": "^1.0.3",
"react-highlight-words": "^0.14.0",
"react-joyride": "^2.5.3",
"react-loading-skeleton": "^3.2.0",
"react-markdown": "^6.0.0",
"react-modal": "^3.8.1",
"react-nice-dates": "^1.0.2",
Expand All @@ -65,14 +71,6 @@
},
"devDependencies": {
"@babel/core": "^7.7.4",
"typescript": "^4.9.5",
"@types/git-url-parse": "^9.0.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-highlight-words": "^0.16.4",
"@types/recompose": "^0.30.10",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@storybook/addon-a11y": "^5.3.0",
"@storybook/addon-actions": "^5.3.0",
"@storybook/addon-docs": "^5.3.0",
Expand All @@ -82,6 +80,13 @@
"@storybook/addons": "^5.3.0",
"@storybook/core": "^5.3.0",
"@storybook/react": "^5.3.0",
"@types/git-url-parse": "^9.0.1",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-highlight-words": "^0.16.4",
"@types/recompose": "^0.30.10",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"apollo-link-schema": "^1.2.4",
"babel-loader": "^8.0.6",
Expand All @@ -91,7 +96,8 @@
"prop-types": "^15.7.2",
"react-is": "^16.12.0",
"regenerator-runtime": "^0.13.3",
"require-context.macro": "^1.2.2"
"require-context.macro": "^1.2.2",
"typescript": "^4.9.5"
},
"postcss": {
"plugins": {
Expand Down
46 changes: 46 additions & 0 deletions src/components/Backups/BackupsSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from "react";
import Skeleton from "react-loading-skeleton";
import { BackupsHeader, DataTable } from "./StyledBackups";

const Backups = () => {
const numberOfBackupFields =
typeof window !== "undefined"
? Math.floor((window.innerHeight * 8) / 10 / 65)
: 10;

const backupFieldSkeleton = (
<div className="data-row">
<div className="source">
<Skeleton />
</div>
<div className="created">
<Skeleton />
</div>

<div className="backupid">
<Skeleton />
</div>
<div className="download">
<Skeleton />
</div>
</div>
);

return (
<div className="backups">
<BackupsHeader>
<label className="source">Source</label>
<label className="created">Created</label>
<label className="backupid">Backup id</label>
</BackupsHeader>

<DataTable>
{[...Array<undefined>(numberOfBackupFields)].map(
() => backupFieldSkeleton
)}
</DataTable>
</div>
);
};

export default Backups;
2 changes: 1 addition & 1 deletion src/components/Box/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { StyledBox } from "./StyledBox";

interface BoxProps {
className?: string;
children: JSX.Element[];
children: JSX.Element[] | JSX.Element;
activeBgs?: string[]; // if present, they act as hover backgrounds
}
const Box: FC<BoxProps> = ({ className = "", activeBgs, children }) => (
Expand Down
7 changes: 3 additions & 4 deletions src/components/Breadcrumbs/BulkDeployment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import React, { FC } from "react";
import { getLinkData } from "components/link/BulkDeployment";
import Breadcrumb from "components/Breadcrumbs/Breadcrumb";

const BulkDeploymentBreadcrumb: FC<{ bulkIdSlug: string }> = ({
const BulkDeploymentBreadcrumb: FC<{ title: string; bulkIdSlug: string }> = ({
title,
bulkIdSlug,
}) => {
const linkData = getLinkData(bulkIdSlug);

return (
<Breadcrumb header="Bulk Deployment" title={bulkIdSlug} {...linkData} />
);
return <Breadcrumb header="Bulk Deployment" title={title} {...linkData} />;
};

export default BulkDeploymentBreadcrumb;
57 changes: 57 additions & 0 deletions src/components/BulkDeployments/BulkDeploymentsSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from "react";
import {
BulkDeploymentsDataTable,
BulkDeploymentsHeader,
} from "./StyledBulkDeployments";
import Skeleton from "react-loading-skeleton";

const BulkDeploymentsSkeleton = () => {
const numberOfItems =
typeof window !== "undefined"
? Math.floor((window.innerHeight * 8) / 10 / 65)
: 10;
const rowItem = (
<div className="data-row">
<div className="project">
<Skeleton />
</div>
<div className="environment">
<Skeleton />
</div>
<div className="name">
<Skeleton />
</div>
<div className="priority">
<Skeleton />
</div>
<div className="started">
<Skeleton />
</div>
<div className="status">
<Skeleton />
</div>
<div className="duration"></div>
<div></div>
</div>
);

return (
<div className="deployments">
<BulkDeploymentsHeader>
<label>Project</label>
<label>Environment</label>
<label>Name</label>
<label className="priority">Priority</label>
<label>Created</label>
<label>Status</label>
<label>Duration</label>
<label></label>
</BulkDeploymentsHeader>
<BulkDeploymentsDataTable>
{[...Array<undefined>(numberOfItems)].map(() => rowItem)}
</BulkDeploymentsDataTable>
</div>
);
};

export default BulkDeploymentsSkeleton;
55 changes: 55 additions & 0 deletions src/components/Deployment/DeploymentSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from "react";
import {
ButtonRow,
DeploymentDetails,
FieldWrapper,
SkeletonWrapper,
} from "./StyledDeployment";
import Skeleton from "react-loading-skeleton";

const DeploymentSkeleton = () => (
<div className="deployment">
<DeploymentDetails>
<FieldWrapper className="created">
<div>
<label>Created</label>
<div className="field">
<Skeleton />
</div>
</div>
</FieldWrapper>
<FieldWrapper className="status">
<div>
<label>Status</label>
<div className="field">
<Skeleton />
</div>
</div>
</FieldWrapper>
<FieldWrapper className="duration">
<div>
<label>Duration</label>
<div className="field">
<Skeleton />
</div>
</div>
</FieldWrapper>
<FieldWrapper className="logstatus">
<div>
<label>Log view</label>
<div className="field">
<Skeleton />
</div>
</div>
</FieldWrapper>
</DeploymentDetails>
<ButtonRow>
<Skeleton />
</ButtonRow>
<SkeletonWrapper>
<Skeleton count={10} style={{ height: "60px", lineHeight: "0.1" }} />
</SkeletonWrapper>
</div>
);

export default DeploymentSkeleton;
4 changes: 4 additions & 0 deletions src/components/Deployment/StyledDeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,7 @@ export const ButtonRow = styled.div`
padding-left: calc(100vw / 16);
}
`;

export const SkeletonWrapper = styled.div`
padding: 0 calc(100vw / 16) 48px;
`;
45 changes: 45 additions & 0 deletions src/components/Deployments/DeploymentsSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from "react";
import Skeleton from "react-loading-skeleton";
import { StyledDeployments } from "./StyledDeployments";

const DeploymentsSkeleton = () => {
const numberOfDeploymentFields =
typeof window !== "undefined"
? Math.floor((window.innerHeight * 8) / 10 / 65)
: 10;

const skeletonItem = (
<div className="data-row">
<div className="name">
<Skeleton />
</div>
<div className="started">
<Skeleton />
</div>
<div className="status">
<Skeleton width={"50%"} />
</div>
<div className="duration">
<Skeleton width={"50%"} />
</div>
</div>
);

return (
<StyledDeployments>
<div className="header">
<label>Name</label>
<label>Created</label>
<label>Status</label>
<label>Duration</label>
</div>
<div className="data-table">
{[...Array<undefined>(numberOfDeploymentFields)].map(
() => skeletonItem
)}
</div>
</StyledDeployments>
);
};

export default DeploymentsSkeleton;
Loading

0 comments on commit 324b24e

Please sign in to comment.