Skip to content

Commit

Permalink
feat: Add integration guides for Zapier apps
Browse files Browse the repository at this point in the history
  • Loading branch information
art7cf committed Feb 25, 2024
1 parent cd99418 commit 0f8b862
Show file tree
Hide file tree
Showing 70 changed files with 1,100 additions and 383 deletions.
2 changes: 1 addition & 1 deletion web/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# API Base URL
VITE_REACT_APP_API_BASE_URL=https://api.nepflow.dev
VITE_REACT_APP_API_BASE_URL=https://api.nepflow.dev/v1
2 changes: 1 addition & 1 deletion web/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# API Base URL
VITE_REACT_APP_API_BASE_URL=http://localhost:5690
VITE_REACT_APP_API_BASE_URL=http://localhost:5690/v1
6 changes: 4 additions & 2 deletions web/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = {
},
"extends": [
"standard-with-typescript",
"plugin:react/recommended"
"plugin:react/recommended",
"plugin:css-modules/recommended"
],
"overrides": [
{
Expand All @@ -25,7 +26,8 @@ module.exports = {
"sourceType": "module"
},
"plugins": [
"react"
"react",
"css-modules"
],
"rules": {
"react/react-in-jsx-scope": "off",
Expand Down
8 changes: 4 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Nepflow Integration Widget</title>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap" rel="stylesheet">
</body>
</html>
1 change: 1 addition & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"babel-preset-es2015": "^6.24.1",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-css-modules": "^2.12.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
Expand Down
4 changes: 4 additions & 0 deletions web/public/icons/chevronRight.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified web/public/zapierAccountClick.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/zapierActionDetails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/zapierTriggerDetails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/public/zapierTriggerTest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
import Root from './routes/root'
import Catalog from './routes/catalog'
import Guide from './routes/guide'
import Service from './routes/service'
import Methods from './routes/service/methods'
import AutoGeneratedGuide from './routes/service/autoGeneratedGuide'

const router = createBrowserRouter([
{
path: '/',
element: <Root />,
children: [
{
path: '/:rootServiceId/guide/:serviceId',
element: <Guide />
path: '/:rootServiceId/service/:serviceId',
element: <Service />,
children: [
{
path: '/:rootServiceId/service/:serviceId/guide/auto',
element: <AutoGeneratedGuide />
},
{
path: '/:rootServiceId/service/:serviceId/',
element: <Methods />
}
]
},
{
path: '/:rootServiceId',
Expand Down
5 changes: 3 additions & 2 deletions web/src/clients/api/queries/getGuide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import apiClient from '..'
import { appHost } from '../../../globals'
import { type IntegrationGuide } from '../../../models/integrationGuide'

async function getGuide (serviceId: string, secondServiceId: string, triggerId: string, actionId: string): Promise<IntegrationGuide> {
async function getGuide (serviceId: string, secondServiceId: string, triggerId: string, actionId: string, guidedRecipeId?: string): Promise<IntegrationGuide> {
const res = await apiClient.get(`/services/${serviceId}/guide/${secondServiceId}/triggers/${triggerId}/actions/${actionId}`, {
params: {
appHost
appHost,
guidedRecipeId
}
})
const result = await res.data
Expand Down
16 changes: 16 additions & 0 deletions web/src/clients/api/queries/getRecommendations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import apiClient from '..'
import { type Recommendation } from '../../../models/recommendation'

async function getRecommendations (serviceKey: string, secondServiceKey: string): Promise<Recommendation[]> {
const res = await apiClient.get('/services/recommendations', {
params: {
serviceKey,
secondServiceKey
}
})
const result = await res.data

return result.recommendations
}

export default getRecommendations
5 changes: 3 additions & 2 deletions web/src/clients/api/queries/getService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import apiClient from '..'
import { appHost } from '../../../globals'
import { type Service } from '../../../models/service'

async function getService (key: string): Promise<Service> {
async function getService (key: string, secondServiceKey?: string): Promise<Service> {
const res = await apiClient.get(`/services/${key}`, {
params: {
appHost
appHost,
secondServiceKey
}
})
const result = await res.data
Expand Down
3 changes: 2 additions & 1 deletion web/src/clients/api/queries/getServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import apiClient from '..'
import { appHost } from '../../../globals'
import { type Service } from '../../../models/service'

async function getServices (search: string = '', skip: number = 0, take: number = 60): Promise<Service[]> {
async function getServices (fromServiceKey?: string, search: string = '', skip: number = 0, take: number = 60): Promise<Service[]> {
const res = await apiClient.get('/services', {
params: {
fromServiceKey,
appHost,
skip,
search,
Expand Down
19 changes: 19 additions & 0 deletions web/src/components/BackButton/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Icon from '../Icon/Icon'
import styles from './backButton.module.css'

interface Props {
onClick: () => void
}

function BackButton ({ onClick }: Props) {
return (
<div
className={styles.backButton}
onClick={onClick}
>
<Icon icon='arrowLeft' className={styles.backButtonIcon} size={18} />
</div>
)
}

export default BackButton
20 changes: 20 additions & 0 deletions web/src/components/BackButton/backButton.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.backButton {
float: left;

text-align: center;
margin-right: 22px;

width: 36px;
height: 36px;
border-radius: 100%;
background-color: rgba(0, 0, 0, 0.05);

cursor: pointer;
}
.backButtonIcon {
opacity: 0.4;
margin: 9px auto 0;
}
.backButton:hover {
background-color: rgba(0, 0, 0, 0.07);
}
3 changes: 3 additions & 0 deletions web/src/components/BackButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import BackButton from './BackButton'

export default BackButton
41 changes: 41 additions & 0 deletions web/src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Icon from '../Icon/Icon'
import styles from './breadcrumbs.module.css'
import { Link } from 'react-router-dom'

interface Item { title: string, path?: string }

interface Props {
items: Array<Item | undefined>
}

function Breadcrumbs ({ items }: Props) {
const filteredItems = items.filter(i => !!i) as Item[]

return (
<div
className={styles.breadcrumbs}
>
{filteredItems.map((item, i) => (
<div key={i.toString()} className={styles.breadcrumbsItem}>
{item.path
? (
<Link to={item.path}>
{item.title}
</Link>
)
: (
<span>
{item.title}
</span>
)}

{i < filteredItems.length - 1 && (
<Icon icon='chevronRight' className={styles.breadcrumbsItemSeparator} size={16} />
)}
</div>
))}
</div>
)
}

export default Breadcrumbs
26 changes: 26 additions & 0 deletions web/src/components/Breadcrumbs/breadcrumbs.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.breadcrumbs {
font-size: 14px;
line-height: 14px;
color: #777;
cursor: default;
}

.breadcrumbsItem {
display: inline-block;
margin-right: 8px;
line-height: 14px;
}
.breadcrumbsItem a {
color: #555;
}
.breadcrumbsItem a:hover {
color: #333;
}

.breadcrumbsItemSeparator {
display: inline-block;
margin-left: 8px;
line-height: 14px;
opacity: 0.5;
margin-top: 0;
}
3 changes: 3 additions & 0 deletions web/src/components/Breadcrumbs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Breadcrumbs from './Breadcrumbs'

export default Breadcrumbs
3 changes: 3 additions & 0 deletions web/src/components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Button from './Button'

export default Button
26 changes: 26 additions & 0 deletions web/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { type ReactNode } from 'react'
import styles from './card.module.css'

interface Props {
className: string | string[]
children?: ReactNode
onClick?: () => void
}

function Card ({ className, children, onClick }: Props) {
let finalClassName = [styles.card]
if (Array.isArray(className)) {
finalClassName = [
...finalClassName,
...className
]
} else {
finalClassName.push(className)
}

return (
<div onClick={onClick} className={finalClassName.join(' ')}>{children}</div>
)
}

export default Card
7 changes: 7 additions & 0 deletions web/src/components/Card/card.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.card {
width: 100%;
background-color: var(--card-color);
border: solid 1px var(--card-border-color);
border-radius: 12px;
color: #000;
}
3 changes: 3 additions & 0 deletions web/src/components/Card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Card from './Card'

export default Card
3 changes: 3 additions & 0 deletions web/src/components/FullScreenLoading/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FullScreenLoading from './FullScreenLoading'

export default FullScreenLoading
19 changes: 19 additions & 0 deletions web/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styles from './header.module.css'
import BackButton from '../BackButton'

interface Props {
title?: string
onBackClick: () => void
}

function Header ({ title, onBackClick }: Props) {
return (
<div className={styles.header}>
<BackButton onClick={onBackClick} />

<div className={styles.headerTitle}>{title}</div>
</div>
)
}

export default Header
9 changes: 9 additions & 0 deletions web/src/components/Header/header.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.header {
margin: 20px 0 30px;
}

.headerTitle {
font-size: 24px;
line-height: 38px;
font-weight: 600;
}
3 changes: 3 additions & 0 deletions web/src/components/Header/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Header from './Header'

export default Header
2 changes: 1 addition & 1 deletion web/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from './icon.module.css'

export type IconKey = 'loading' | 'search' | 'arrowLeft' | 'arrowRightCircle'
export type IconKey = 'loading' | 'search' | 'arrowLeft' | 'arrowRightCircle' | 'chevronRight'

interface Props {
icon: IconKey
Expand Down
3 changes: 3 additions & 0 deletions web/src/components/Icon/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Icon from './Icon'

export default Icon

0 comments on commit 0f8b862

Please sign in to comment.