Skip to content
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: add several form components and implementations #1199

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22,178 changes: 11,107 additions & 11,071 deletions package-lock.json

Large diffs are not rendered by default.

257 changes: 129 additions & 128 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,128 +1,129 @@
{
"name": "sprout-ui",
"private": true,
"version": "0.0.9",
"type": "module",
"main": "build/main.js",
"engineStrict": true,
"author": "Michael Taylor",
"description": "Sprout UI",
"engines": {
"node": ">=18.16.0"
},
"scripts": {
"start": "vite",
"build": "tsc && cp src/preload.js build/preload.js && vite build",
"electron": "tsc && cp src/preload.js build/preload.js && cross-env NODE_ENV=development electron .",
"dev": "concurrently \"npm run start\" \"npm run electron\"",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"clean": "rm -rf dist && rm -rf build",
"prepare": "husky install",
"electron:package:mac": "npm run clean && npm run build && electron-builder -m -c.extraMetadata.main=build/main.js",
"electron:package:win": "npm run clean && npm run build && electron-builder -w -c.extraMetadata.main=build/main.js",
"electron:package:linux": "npm run clean && npm run build && electron-builder -l -c.extraMetadata.main=build/main.js"
},
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@types/styled-components": "^5.1.34",
"chia-dat-seeder": "^1.0.1",
"chia-datalayer": "^2.0.17",
"chia-datalayer-fs-deploy": "^1.0.15",
"chia-root-resolver": "^1.0.0",
"chia-wallet": "^1.0.18",
"chia-web2-gateway": "^1.0.10",
"components": "^0.1.0",
"express": "^4.19.2",
"flowbite": "^2.3.0",
"flowbite-react": "^0.7.8",
"flowbite-typography": "^1.0.3",
"formik": "^2.4.5",
"lodash": "^4.17.21",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-content-loader": "^7.0.0",
"react-dom": "^18.2.0",
"react-intl": "^6.6.4",
"react-redux": "^9.1.0",
"react-router-dom": "^6.22.3",
"react-webview": "^0.1.0",
"redux-persist": "^6.0.0",
"simplebar": "^6.2.5",
"simplebar-react": "^3.2.4",
"styled-components": "^6.1.8",
"uuid": "^9.0.1",
"xterm": "^5.3.0",
"yup": "^1.4.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^19.1.0",
"@types/react": "^18.2.74",
"@types/react-dom": "^18.2.24",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^28.2.10",
"electron-builder": "^24.13.3",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"standard-version": "^9.5.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.4",
"vite": "^5.2.8",
"wait-on": "^7.2.0"
},
"standard-version": {
"skip": {
"bump": true,
"commit": true,
"tag": true
}
},
"lint-staged": {
"*.+(js|ts|tsx)": "npm run lint:prettier-eslint"
},
"build": {
"appId": "storage.datalayer.sprout-ui",
"productName": "sprout-ui",
"files": [
"build/renderer/**/*",
"build/**/*",
"node_modules/**/*"
],
"directories": {
"buildResources": "public"
},
"mac": {
"target": {
"target": "dmg",
"arch": [
"universal"
]
},
"publish": null
},
"win": {
"target": "nsis",
"publish": null
},
"linux": {
"target": "deb",
"description": "Sprout UI.",
"maintainer": "Michael Taylor",
"vendor": "https://datalayer.storage/",
"publish": null
}
}
}
{
"name": "sprout-ui",
"private": true,
"version": "0.0.9",
"type": "module",
"main": "build/main.js",
"engineStrict": true,
"author": "Michael Taylor",
"description": "Sprout UI",
"engines": {
"node": ">=18.16.0"
},
"scripts": {
"start": "vite",
"build": "tsc && cp src/preload.js build/preload.js && vite build",
"electron": "tsc && cp src/preload.js build/preload.js && cross-env NODE_ENV=development electron .",
"dev": "concurrently \"npm run start\" \"npm run electron\"",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"clean": "rm -rf dist && rm -rf build",
"prepare": "husky install",
"electron:package:mac": "npm run clean && npm run build && electron-builder -m -c.extraMetadata.main=build/main.js",
"electron:package:win": "npm run clean && npm run build && electron-builder -w -c.extraMetadata.main=build/main.js",
"electron:package:linux": "npm run clean && npm run build && electron-builder -l -c.extraMetadata.main=build/main.js"
},
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@types/styled-components": "^5.1.34",
"chia-dat-seeder": "^1.0.1",
"chia-datalayer": "^2.0.17",
"chia-datalayer-fs-deploy": "^1.0.15",
"chia-root-resolver": "^1.0.0",
"chia-wallet": "^1.0.18",
"chia-web2-gateway": "^1.0.10",
"components": "^0.1.0",
"dayjs": "^1.11.10",
"express": "^4.19.2",
"flowbite": "^2.3.0",
"flowbite-react": "^0.7.8",
"flowbite-typography": "^1.0.3",
"formik": "^2.4.5",
"lodash": "^4.17.21",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-content-loader": "^7.0.0",
"react-dom": "^18.2.0",
"react-intl": "^6.6.4",
"react-redux": "^9.1.0",
"react-router-dom": "^6.22.3",
"react-webview": "^0.1.0",
"redux-persist": "^6.0.0",
"simplebar": "^6.2.5",
"simplebar-react": "^3.2.4",
"styled-components": "^6.1.8",
"uuid": "^9.0.1",
"xterm": "^5.3.0",
"yup": "^1.4.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^19.1.0",
"@types/react": "^18.2.74",
"@types/react-dom": "^18.2.24",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"cross-env": "^7.0.3",
"electron": "^28.2.10",
"electron-builder": "^24.13.3",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"standard-version": "^9.5.0",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.4",
"vite": "^5.2.8",
"wait-on": "^7.2.0"
},
"standard-version": {
"skip": {
"bump": true,
"commit": true,
"tag": true
}
},
"lint-staged": {
"*.+(js|ts|tsx)": "npm run lint:prettier-eslint"
},
"build": {
"appId": "storage.datalayer.sprout-ui",
"productName": "sprout-ui",
"files": [
"build/renderer/**/*",
"build/**/*",
"node_modules/**/*"
],
"directories": {
"buildResources": "public"
},
"mac": {
"target": {
"target": "dmg",
"arch": [
"universal"
]
},
"publish": null
},
"win": {
"target": "nsis",
"publish": null
},
"linux": {
"target": "deb",
"description": "Sprout UI.",
"maintainer": "Michael Taylor",
"vendor": "https://datalayer.storage/",
"publish": null
}
}
}
108 changes: 60 additions & 48 deletions src/renderer/api/cadt/v1/projects/projects.api.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,61 @@
import {cadtApi, projectsTag,} from "../";
import {Project} from "@/schemas/Project.schema";

interface GetProjectsParams {
page: number;
orgUid?: string;
search?: string;
order?: string;
}

interface GetProjectsResponse {
page: number,
pageCount: number,
data: Project[]
}

const projectsApi = cadtApi.injectEndpoints({
endpoints: (builder) => ({
getProjects: builder.query<GetProjectsResponse, GetProjectsParams>({
query: ({ page, orgUid, search, order }: GetProjectsParams) => {
// Initialize the params object with page and limit
const params: GetProjectsParams & {limit: number} = { page, limit: 10 };

if (orgUid) {
params.orgUid = orgUid;
}

if (search) {
params.search = search.replace(/[^a-zA-Z0-9 _.-]+/, '');
}

if (order) {
params.order = order;
}

return {
url: `/v1/projects`,
params,
method: 'GET',
};
},
providesTags: (_response, _error, {orgUid}) => [{type: projectsTag, id: orgUid}],
})
})
});

export const {
useGetProjectsQuery
import {cadtApi, projectsTag,} from "../";
import {Project} from "@/schemas/Project.schema";

interface GetProjectsParams {
page: number;
orgUid?: string;
search?: string;
order?: string;
}

interface GetProjectParams {
warehouseProjectId: string;
}

interface GetProjectsResponse {
page: number,
pageCount: number,
data: Project[]
}

const projectsApi = cadtApi.injectEndpoints({
endpoints: (builder) => ({
getProjects: builder.query<GetProjectsResponse, GetProjectsParams>({
query: ({ page, orgUid, search, order }: GetProjectsParams) => {
// Initialize the params object with page and limit
const params: GetProjectsParams & {limit: number} = { page, limit: 10 };

if (orgUid) {
params.orgUid = orgUid;
}

if (search) {
params.search = search.replace(/[^a-zA-Z0-9 _.-]+/, '');
}

if (order) {
params.order = order;
}

return {
url: `/v1/projects`,
params,
method: 'GET',
};
},
providesTags: (_response, _error, {orgUid}) => [{type: projectsTag, id: orgUid}],
}),
getProject: builder.query<Project, GetProjectParams>({
query: ({ warehouseProjectId }: GetProjectParams) => ({
url: `/v1/projects`,
params: { warehouseProjectId },
method: 'GET',
}),
}),
})
});

export const {
useGetProjectsQuery,
useGetProjectQuery
} = projectsApi;
Loading