-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: first with boilerplate #1
Merged
Merged
Changes from 45 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
4e87458
feat: first with boilerplate
6df602d
feat: api boilerplate
9662148
feat: provider boilerplate
479af8e
feat: hooks boilerplate
01e51ff
chore: update readme to remove nextjs sample text
785916d
feat: components boilerplate
86f86cf
feat: base pages
41b7d3c
fix: linting prettier
a32983b
fix: lint your agents
0cb7594
feature: spawning page component boilerplate code
24bb530
feat: added swr and icons
77dc0ff
feature: added layout components i.e navbar
4809cb7
feature: add marketplace item component
1b42099
feat: add agents context and hooks
12329f7
chore: use enums for tabs
e8c95e5
fix: wrap app in layout
6a08a73
feat: add api boilerplate code
991bba0
Update eslint configuration and package.json scripts
truemiller a5cd27a
Add Jest and testing libraries to devDependencies
truemiller a6ec40a
Add child_process dependency to package.json
truemiller 7f3731b
Add .env file to .gitignore
truemiller e0cdd08
Add Docker commands to run and stop agents
truemiller b3346e2
Add child_process package
truemiller 7d3c4e7
Add frontend workflow and update ESLint configuration
truemiller f9ac35b
Refactor code and update tsconfig.json
truemiller 8e791c0
Add working directory for frontend build
truemiller e6db20b
Update frontend workflow to trigger only on pull requests
truemiller 947107e
Update eslint configuration and package dependencies
truemiller 7155403
Update ESLint configuration and package dependencies
truemiller bf22e42
Fix missing semicolon in Layout.test.tsx
truemiller c2831c3
Delete unused components and add new components for spawning agents
truemiller 991bfd9
Refactor useAgents and add testFlask to Home
truemiller 7803ae3
fix: lift electron into root and resolve comments
truemiller 40d9ff5
update github actions
truemiller ce1325a
Update .gitignore and package.json
1077ee7
Merge branch 'feature/frontend-boilerplate' of github.com:valory-xyz/…
e69b760
Refactor workflow and update SpawnHeader component
truemiller 32160d4
Add .gitignore entries for Python files
truemiller ae3d175
updates
truemiller 7645ff7
Add copyToClipboard helper function
truemiller 1fdd205
Update Spawn flow
truemiller f30fd83
Add new enums for Tabs and URLs, remove unused code, and update depen…
truemiller 1361d99
Add new files and components, update existing components
truemiller 81252e7
Update URLs, enums, and components
truemiller ac63f53
Update window height and add title
truemiller 7070ab3
Update loading.html and main.js, and remove transpilePackages in next…
truemiller f72d668
Update dev:python script in package.json
1e1a7b3
Add script pychache to .gitignore
b544d2c
Update API endpoint in useAgents hook
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"extends": [ | ||
"next/core-web-vitals", | ||
"eslint:recommended", | ||
"plugin:jest/recommended", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"globals": { | ||
"JSX": true, | ||
"React": true | ||
}, | ||
"plugins": [ | ||
"jest", | ||
"prettier", | ||
"react", | ||
"react-hooks" | ||
], | ||
"rules": { | ||
"no-console": "warn", | ||
"no-unused-vars": "off", | ||
"prettier/prettier": ["error", { | ||
"endOfLine": "auto", | ||
"semi": true | ||
}], | ||
"react/jsx-props-no-spreading": "off", | ||
"react/no-array-index-key": "off", | ||
"react/react-in-jsx-scope": "off", | ||
"react-hooks/rules-of-hooks": "error", | ||
"react-hooks/exhaustive-deps": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# TBA | ||
name: Frontend Workflow | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
# Node | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20.11" | ||
# Python | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
version: "1.7.1" | ||
virtualenvs-create: true | ||
virtualenvs-in-project: false | ||
virtualenvs-path: ~/my-custom-path | ||
installer-parallel: true | ||
# Install dependencies | ||
- name: Install dependencies | ||
run: yarn | ||
# Lint and test | ||
- name: Lint | ||
run: yarn lint | ||
- name: Test | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,41 @@ | ||
data/ | ||
__pycache__/ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# python | ||
data | ||
backend/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# olas-operate-app | ||
Frontend Electron + NextJS application for the Olas Operate App. | ||
|
||
## Technologies Used | ||
- NextJS | ||
- Electron | ||
- AntD | ||
- TypeScript | ||
- Python | ||
- Flask | ||
- Poetry | ||
|
||
|
||
## Getting Started | ||
|
||
### Install Yarn | ||
|
||
```bash | ||
npm install --global yarn | ||
``` | ||
|
||
### Install dependencies | ||
|
||
```bash | ||
yarn | ||
``` | ||
|
||
### Run the development app | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { PropsWithChildren } from "react"; | ||
import { Navbar } from "./Navbar/Navbar"; | ||
import { Flex } from "antd"; | ||
|
||
export const Layout = ({ children }: PropsWithChildren) => { | ||
return ( | ||
<Flex vertical> | ||
<Navbar /> | ||
{children} | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { BellOutlined, SettingOutlined } from "@ant-design/icons"; | ||
import { Flex, Typography } from "antd"; | ||
|
||
export const Navbar = () => { | ||
return ( | ||
<Flex vertical={false} justify="space-between" style={{ minWidth: "100%" }}> | ||
<Typography.Text style={{ fontWeight: 700 }}>Operate</Typography.Text> | ||
<Flex gap={4}> | ||
<BellOutlined /> | ||
<SettingOutlined /> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Flex } from "antd"; | ||
import { MarketplaceItem } from "./MarketplaceItem"; | ||
|
||
export const Marketplace = () => { | ||
return ( | ||
<Flex vertical> | ||
<MarketplaceItem /> | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Row, Col, Button } from "antd"; | ||
import Image from "next/image"; | ||
export const MarketplaceItem = () => { | ||
return ( | ||
<Row gutter={16}> | ||
<Col span={8}> | ||
<Image | ||
src="" | ||
alt="Image" | ||
style={{ | ||
minWidth: "100%", | ||
minHeight: "100%", | ||
border: "1px solid black", | ||
}} | ||
/> | ||
</Col> | ||
<Col span={16}> | ||
<h2>Agent Name</h2> | ||
<p>Agent Description</p> | ||
<Button href="/spawn/1" type="primary"> | ||
Run this agent | ||
</Button> | ||
</Col> | ||
</Row> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Modal } from "antd"; | ||
import { Dispatch, SetStateAction } from "react"; | ||
type QRModalProps = { | ||
open: boolean; | ||
setOpen: Dispatch<SetStateAction<boolean>>; | ||
address: string; | ||
}; | ||
|
||
export const QRModal = ({ open, setOpen, address }: QRModalProps) => { | ||
return <Modal open={open} onCancel={() => setOpen(false)} footer={null} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { SpawnState } from "@/enums/SpawnState"; | ||
import { Tab } from "@/enums/Tabs"; | ||
import { useSpawn } from "@/hooks/useSpawn"; | ||
import { useTabs } from "@/hooks/useTabs"; | ||
import { Button, Flex } from "antd"; | ||
import { useRouter } from "next/router"; | ||
|
||
export const SpawnDone = () => { | ||
const router = useRouter(); | ||
|
||
const { setSpawnState } = useSpawn(); | ||
const { setActiveTab } = useTabs(); | ||
|
||
const handleViewAgent = () => { | ||
router.push("/").then(() => { | ||
setActiveTab(Tab.YOUR_AGENTS); | ||
setSpawnState(SpawnState.RPC); | ||
}); | ||
}; | ||
|
||
return ( | ||
<Flex gap={8} vertical> | ||
<Button type="primary" onClick={handleViewAgent}> | ||
View agent | ||
</Button> | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { SpawnState } from "@/enums/SpawnState"; | ||
import { copyToClipboard } from "@/helpers/copyToClipboard"; | ||
import { useSpawn } from "@/hooks/useSpawn"; | ||
import { Button, Flex, Timeline, Typography } from "antd"; | ||
import { useMemo } from "react"; | ||
|
||
const mockRequiresFunds = [ | ||
{ amount: 0.1, currency: "xDAI", to: "0xTest", recieved: true }, | ||
]; | ||
|
||
export const SpawnFunds = () => { | ||
const { setSpawnState } = useSpawn(); | ||
|
||
const handleContinue = () => { | ||
setSpawnState(SpawnState.DONE); | ||
}; | ||
|
||
const items = useMemo( | ||
() => | ||
mockRequiresFunds.map((mock) => ({ | ||
children: ( | ||
<Flex gap={8} vertical key={mock.to}> | ||
<Typography.Text> | ||
Send {mock.amount} {mock.currency} to: {mock.to} | ||
</Typography.Text> | ||
<Flex gap={8}> | ||
<Button type="primary" onClick={() => copyToClipboard(mock.to)}> | ||
Copy address | ||
</Button> | ||
<Button type="default">Show QR</Button> | ||
</Flex> | ||
</Flex> | ||
), | ||
})), | ||
[], | ||
); | ||
|
||
const hasSentAllFunds = useMemo( | ||
() => mockRequiresFunds.every((mock) => mock.recieved), | ||
[], | ||
); | ||
|
||
return ( | ||
<Flex gap={8} vertical> | ||
<Typography.Text>Your agent needs funds!</Typography.Text> | ||
<Timeline items={items} /> | ||
<Button | ||
type="default" | ||
disabled={!hasSentAllFunds} | ||
onClick={handleContinue} | ||
> | ||
Continue | ||
</Button> | ||
</Flex> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useSpawn } from "@/hooks/useSpawn"; | ||
import { Progress, Typography } from "antd"; | ||
import Image from "next/image"; | ||
import { useMemo } from "react"; | ||
|
||
export const SpawnHeader = () => { | ||
const { spawnPercentage } = useSpawn(); | ||
|
||
const title = useMemo( | ||
() => (spawnPercentage === 100 ? "Agent Spawned" : "Spawn your Agent"), | ||
[spawnPercentage], | ||
); | ||
|
||
return ( | ||
<> | ||
<Image src="/robot-head.png" alt="robot head" width={200} height={200} /> | ||
<Typography.Title>{title}</Typography.Title> | ||
<Progress percent={spawnPercentage} /> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Our path naming convention elsewhere is usually
Navbar/index.jsx
, but I have thought for a while like thisNavbar/Navbar.tsx
is easier to read when searching. Would suggest we move towards this. Thoughts @mohandast52?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.
yes, agreed 💯 This structure is far easier to navigate compared to a bunch of index files.