Skip to content

Commit

Permalink
Development - merge (#17)
Browse files Browse the repository at this point in the history
* enhancement(frontend) patched all ESLint issues and some changes

* fix(global): fixed build problems in dashboard

* fix(global): changed action to only fail when not formated

* chore(global): formatted README.md

* fix(actions): fixed codeql.yml

---------

Co-authored-by: Zunw <[email protected]>
  • Loading branch information
zZHorizonZz and ZunwDev authored Jun 15, 2023
1 parent e745128 commit 9df9226
Show file tree
Hide file tree
Showing 28 changed files with 452 additions and 439 deletions.
64 changes: 34 additions & 30 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ name: "CodeQL"

on:
push:
branches: [ "master" ]
branches:
- master
- development
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
branches:
- master
- development
schedule:
- cron: '24 8 * * 3'

Expand All @@ -33,45 +37,45 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
26 changes: 26 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Continuous Integration

# This action works with pull requests and pushes
on:
pull_request:
push:
branches:
- master
- development

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}

- name: Prettify code
uses: creyD/[email protected]
with:
dry: True
prettier_options: --check **/*.{js,md,tsx,ts,jsx}
26 changes: 26 additions & 0 deletions dashboard/src/components/base/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';

export const Button = ({
className = '',
disabled,
...props
}: {
className?: string;
disabled?: boolean;
} & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
const buttonClasses = `rounded-md border-transparent bg-amber-200 px-4 py-2 text-sm font-medium text-amber-900 ${
!disabled
? 'hover:bg-amber-400 hover:border-transparent cursor-pointer'
: '!cursor-default opacity-80'
} transition duration-150 ease-in-out ${className}`;

return <button className={buttonClasses.trim()} {...props}></button>;
};

export const RequiredLabel = ({ text }: { text: string }) => {
return (
<p className="text-sm text-gray-500">
{text}:<span className="text-red-600"> *</span>
</p>
);
};
44 changes: 22 additions & 22 deletions dashboard/src/components/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ link in `palette.tsx`). There are some ready-to-use palettes for popular React l
packages and can be added as a dependency:

```jsx
import AntdPalette from "@react-buddy/palette-antd";
import ReactIntlPalette from "@react-buddy/palette-react-intl";
import AntdPalette from '@react-buddy/palette-antd';
import ReactIntlPalette from '@react-buddy/palette-react-intl';

export const PaletteTree = () => (
<Palette>
<AntdPalette/>
<ReactIntlPalette/>
<AntdPalette />
<ReactIntlPalette />
<Category name="App templates">
<Component name="Card">
<Variant name="Loading">
<Card title="Card title">
<Skeleton loading={true} avatar active>
Card content
Card content
</Skeleton>
</Card>
</Variant>
</Component>
<Component name="Form">
<Variant proto={FormTemplate}/>
<Variant proto={FormTemplate} />
</Component>
</Category>
</Palette>
)
);
```

React Buddy explicitly registers any previewed component in the `previews.tsx` file so that you can specify required
props.

```jsx
<ComponentPreview path="/Page">
<Page title={'Hello'}/>
<Page title={'Hello'} />
</ComponentPreview>
```

Expand All @@ -51,20 +51,20 @@ e.g. implicitly obtain user session:

```typescript
export const useInitial: () => InitialHookStatus = () => {
const [loading, setLoading] = useState<boolean>(false);
const [error, setError] = useState<boolean>(false);
const [loading, setLoading] = useState<boolean>(false);
const [error, setError] = useState<boolean>(false);

useEffect(() => {
setLoading(true);
async function login() {
const response = await loginRequest(DEV_LOGIN, DEV_PASSWORD);
if (response?.status !== 200) {
setError(true);
}
setLoading(false);
}
login();
}, []);
return { loading, error };
useEffect(() => {
setLoading(true);
async function login() {
const response = await loginRequest(DEV_LOGIN, DEV_PASSWORD);
if (response?.status !== 200) {
setError(true);
}
setLoading(false);
}
login();
}, []);
return { loading, error };
};
```
5 changes: 1 addition & 4 deletions dashboard/src/components/dev/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import { useInitial } from './useInitial';

const ComponentPreviews = React.lazy(() => import('./previews'));

export {
ComponentPreviews,
useInitial
};
export { ComponentPreviews, useInitial };
14 changes: 8 additions & 6 deletions dashboard/src/components/dev/previews.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React from 'react';
import { ComponentPreview, Previews } from '@react-buddy/ide-toolbox-next';
import { PaletteTree } from './palette';
import Nav from '~/components/navbar/nav.component';
import Navbar from '~/components/navbar/navbar.component';

const ComponentPreviews = () => {
return <Previews palette={<PaletteTree />}>
<ComponentPreview path='/Nav'>
<Nav />
</ComponentPreview>
</Previews>;
return (
<Previews palette={<PaletteTree />}>
<ComponentPreview path="/Nav">
<Navbar />
</ComponentPreview>
</Previews>
);
};

export default ComponentPreviews;
Loading

1 comment on commit 9df9226

@vercel
Copy link

@vercel vercel bot commented on 9df9226 Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiperist – ./

heligion.vercel.app
shiperist-git-master-zzhorizonzz.vercel.app
shiperist-zzhorizonzz.vercel.app

Please sign in to comment.