Skip to content

Commit

Permalink
Merge pull request #46 from sora-vp/init-client-major
Browse files Browse the repository at this point in the history
Menambahkan client attendance dan chooser
  • Loading branch information
reacto11mecha authored Jul 2, 2024
2 parents b8da8ed + b9f5851 commit 3d04c12
Show file tree
Hide file tree
Showing 92 changed files with 3,849 additions and 2,819 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ DB_PASSWORD=''
# node -e 'console.log(require("crypto").randomBytes(50).toString("base64"));'
# @see https://next-auth.js.org/configuration/options#secret
AUTH_SECRET='supersecret'

# RabbitMQ
# This env variable will connect to rabbitmq instance
AMQP_URL="amqp://localhost"

# API Endpoint
# This env variable will tell the vote processor where is the trpc endpoint
PROCESSOR_API_URL="http://localhost:3000/api/trpc"
7 changes: 0 additions & 7 deletions apps/auth-proxy/.env.example

This file was deleted.

22 changes: 0 additions & 22 deletions apps/auth-proxy/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions apps/auth-proxy/eslint.config.js

This file was deleted.

29 changes: 0 additions & 29 deletions apps/auth-proxy/package.json

This file was deleted.

17 changes: 0 additions & 17 deletions apps/auth-proxy/routes/[...auth].ts

This file was deleted.

4 changes: 0 additions & 4 deletions apps/auth-proxy/tsconfig.json

This file was deleted.

2 changes: 2 additions & 0 deletions apps/clients/attendance/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is useful for development or manual deployment
VITE_TRPC_URL="http://maybeyourlocalip/api/trpc"
24 changes: 24 additions & 0 deletions apps/clients/attendance/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
30 changes: 30 additions & 0 deletions apps/clients/attendance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: ["./tsconfig.json", "./tsconfig.node.json"],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
27 changes: 27 additions & 0 deletions apps/clients/attendance/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @ts-check

import eslint from "@eslint/js";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

import { restrictEnvAccess } from "@sora-vp/eslint-config/base";
import reactConfig from "@sora-vp/eslint-config/react";

export default tseslint.config(
{
ignores: ["dist/**"],
plugins: {
"react-refresh": reactRefresh,
},
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
...reactConfig,
...restrictEnvAccess,
);
13 changes: 13 additions & 0 deletions apps/clients/attendance/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Attendance Client</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
61 changes: 61 additions & 0 deletions apps/clients/attendance/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@sora-vp/client-attendance",
"private": true,
"version": "2.3.1",
"type": "module",
"scripts": {
"build": "yarn with-env vite build",
"clean": "git clean -xdf dist .turbo node_modules",
"dev": "yarn with-env vite",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@sora-vp/api": "*",
"@sora-vp/ui": "*",
"@sora-vp/validators": "*",
"@t3-oss/env-core": "^0.10.1",
"@tanstack/react-query": "^5.35.1",
"@trpc/client": "11.0.0-rc.364",
"@trpc/react-query": "11.0.0-rc.364",
"@trpc/server": "11.0.0-rc.364",
"framer-motion": "^11.2.12",
"jotai": "^2.8.4",
"lucide-react": "^0.399.0",
"non.geist": "^1.0.3",
"qr-scanner": "^1.4.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.0",
"superjson": "2.2.1",
"zod": "^3.23.8"
},
"devDependencies": {
"@eslint/js": "^9.6.0",
"@fontsource-variable/noto-sans-sundanese": "^5.0.18",
"@sora-vp/eslint-config": "*",
"@sora-vp/prettier-config": "*",
"@sora-vp/tailwind-config": "*",
"@types/eslint__js": "^8.42.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.19",
"dotenv-cli": "^7.4.1",
"eslint": "^9.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.39",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5",
"typescript-eslint": "^7.14.1",
"vite": "^5.3.1"
},
"prettier": "@sora-vp/prettier-config"
}
6 changes: 6 additions & 0 deletions apps/clients/attendance/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-disable */
module.exports = {
plugins: {
tailwindcss: {},
},
};
Binary file added apps/clients/attendance/public/favicon.ico
Binary file not shown.
54 changes: 54 additions & 0 deletions apps/clients/attendance/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { useState } from "react";
import { ServerSettingProvider } from "@/context/server-setting";
import MainPage from "@/routes/main-page";
import { api } from "@/utils/api";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { httpBatchLink } from "@trpc/client";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import superjson from "superjson";

import { env } from "./env";

const router = createBrowserRouter([
{
path: "/",
element: <MainPage />,
},
{
path: "about",
element: <div>About</div>,
},
]);

const getBaseUrl = () => {
if (!env.VITE_IS_DOCKER && env.VITE_TRPC_URL) return env.VITE_TRPC_URL;

if (import.meta.env.DEV && !env.VITE_IS_DOCKER && !env.VITE_TRPC_URL)
return "http://localhost:3000/api/trpc";

return "/api/trpc";
};

export default function App() {
const [queryClient] = useState(() => new QueryClient());
const [trpcClient] = useState(() =>
api.createClient({
links: [
httpBatchLink({
url: getBaseUrl(),
transformer: superjson,
}),
],
}),
);

return (
<api.Provider client={trpcClient} queryClient={queryClient}>
<QueryClientProvider client={queryClient}>
<ServerSettingProvider>
<RouterProvider router={router} />
</ServerSettingProvider>
</QueryClientProvider>
</api.Provider>
);
}
Loading

0 comments on commit 3d04c12

Please sign in to comment.