Skip to content
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ node_modules/

commit/public/node_modules/
commit/www/commit.html
commit/public/commit
commit/www/commit-docs.html
commit/public/commit
commit/public/docs
23 changes: 21 additions & 2 deletions commit/commit/doctype/commit_settings/commit_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,39 @@
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"show_system_apps"
"show_system_apps",
"commit_docs_header",
"commit_docs_description",
"commit_docs_header_image_url"
],
"fields": [
{
"default": "1",
"fieldname": "show_system_apps",
"fieldtype": "Check",
"label": "Show System Apps"
},
{
"fieldname": "commit_docs_header",
"fieldtype": "Data",
"label": "Commit Docs Header"
},
{
"fieldname": "commit_docs_description",
"fieldtype": "Small Text",
"label": "Commit Docs Description"
},
{
"description": "Upload File URL for the image, that will visible on landing page of docs. format(SVG,PNG,JPG)",
"fieldname": "commit_docs_header_image_url",
"fieldtype": "Attach Image",
"label": "Commit Docs Header Image URL"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-05-15 14:36:45.392360",
"modified": "2025-03-07 15:40:53.518886",
"modified_by": "Administrator",
"module": "commit",
"name": "Commit Settings",
Expand Down
2 changes: 1 addition & 1 deletion commit/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@
# ]
fixtures = [{"doctype": "Server Script", "filters": [["module" , "in" , ("commit" )]]}]

website_route_rules = [{'from_route': '/commit/<path:app_path>', 'to_route': 'commit'}]
website_route_rules = [{'from_route': '/docs/<path:app_path>', 'to_route': 'commit-docs'}, {'from_route': '/commit/<path:app_path>', 'to_route': 'commit'}]
18 changes: 18 additions & 0 deletions commit/www/commit-docs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Docs</title>
<script type="module" crossorigin src="/assets/commit/docs/assets/index-C8R1wBfR.js"></script>
<link rel="stylesheet" crossorigin href="/assets/commit/docs/assets/index-DSE1wBA8.css">
</head>

<body>
<div id="root"></div>
<script>window.csrf_token = '{{ frappe.session.csrf_token }}';</script>
</body>

</html>
4 changes: 4 additions & 0 deletions commit/www/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ def get_boot():
commit_settings = frappe.get_single("Commit Settings")

show_system_apps = commit_settings.show_system_apps


boot["show_system_apps"] = show_system_apps
boot["commit_docs_header"] = commit_settings.commit_docs_header
boot["commit_docs_description"] = commit_settings.commit_docs_description
boot["commit_docs_header_image_url"] = commit_settings.commit_docs_header_image_url
boot["get_installed_apps"] = get_installed_apps()
boot["get_all_commit_docs_detail"] = get_all_commit_docs_detail()

Expand Down
18 changes: 18 additions & 0 deletions commit/www/docs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Docs</title>
<script type="module" crossorigin src="/assets/commit/docs/assets/index-B9Jr7w0S.js"></script>
<link rel="stylesheet" crossorigin href="/assets/commit/docs/assets/index-D7Hamakg.css">
</head>

<body>
<div id="root"></div>
<script>window.csrf_token = '{{ frappe.session.csrf_token }}';</script>
</body>

</html>
Empty file.
6 changes: 6 additions & 0 deletions dashboard/src/types/commit/CommitSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ export interface CommitSettings{
idx?: number
/** Show System Apps : Check */
show_system_apps?: 0 | 1
/** Commit Docs Header : Data */
commit_docs_header?: string
/** Commit Docs Description : Small Text */
commit_docs_description?: string
/** Commit Docs Header Image URL : Attach Image - Upload File URL for the image, that will visible on landing page of docs. format(SVG,PNG,JPG) */
commit_docs_header_image_url?: string
}
8 changes: 8 additions & 0 deletions dashboard/src/utils/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ export const getSystemDefault = (fieldName: string, fallback?: any) => {
export const getUserDefaults = (fieldName: string, fallback?: any) => {
// @ts-expect-error
return window.frappe?.boot?.user?.defaults?.[fieldName] ?? fallback
}

export const getCommitDocsHeaderAndDescription = () => {
// @ts-expect-error
const header = window.frappe?.boot?.commit_docs_header ?? ''
// @ts-expect-error
const commit_docs_description = window.frappe?.boot?.commit_docs_description ?? ''
return { header, commit_docs_description }
}
1 change: 1 addition & 0 deletions docs/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BASE_PATH='/commit-docs'
24 changes: 24 additions & 0 deletions docs/.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?
50 changes: 50 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 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 tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})
```

- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
- Optionally add `...tseslint.configs.stylisticTypeChecked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:

```js
// eslint.config.js
import react from 'eslint-plugin-react'

export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})
```
21 changes: 21 additions & 0 deletions docs/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "zinc",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
30 changes: 30 additions & 0 deletions docs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
}
);
17 changes: 17 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Docs</title>
</head>

<body>
<div id="root"></div>
<script>window.csrf_token = '{{ frappe.session.csrf_token }}';</script>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
64 changes: 64 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "docs",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --base=/assets/commit/docs/ && yarn copy-html-entry",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"copy-html-entry": "cp ../commit/public/docs/index.html ../commit/www/commit-docs.html"
},
"dependencies": {
"@mdx-js/mdx": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@mdx-js/rollup": "^3.1.0",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.4",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-toast": "^1.2.4",
"@radix-ui/react-tooltip": "^1.1.6",
"@tailwindcss/typography": "^0.5.16",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"framer-motion": "^11.18.0",
"frappe-react-sdk": "^1.10.0",
"jotai": "^2.11.0",
"lodash": "^4.17.21",
"lodash.isplainobject": "^4.0.6",
"lucide-react": "^0.471.1",
"moment-timezone": "^0.5.46",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.1.2",
"rehype-katex": "^7.0.1",
"rehype-pretty-code": "^0.14.0",
"rehype-raw": "^7.0.0",
"rehype-slug": "^6.0.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"shiki": "^1.27.2",
"swr": "^2.3.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"tailwindcss-typography": "^3.1.0",
"timeago-react": "^3.0.6"
},
"devDependencies": {
"@types/node": "^22.10.7",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"eslint": "^9.17.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0",
"postcss": "^8.5.1",
"tailwindcss": "^3.4.17",
"typescript": "~5.6.2",
"vite": "^6.0.5"
}
}
6 changes: 6 additions & 0 deletions docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
20 changes: 20 additions & 0 deletions docs/proxyOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let webserver_port = "8001";
try {
const common_site_config = require('../../../sites/common_site_config.json');
webserver_port = common_site_config.webserver_port;
} catch {
console.log("common_site_config.json not found");
}

export default {
'^/(app|api|assets|files|private)': {
target: `http://127.0.0.1:${webserver_port}`,
ws: true,
changeOrigin: true,
secure: false,
router: function (req) {
const site_name = req.headers.host.split(':')[0];
return `http://${site_name}:${webserver_port}`;
},
},
};
Loading