diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 00000000..9a07d9f8 --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,98 @@ +name: Deploy code + +on: + push: + branches: + - next + workflow_dispatch: + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - name: Install Native Dependencies + run: | + sudo apt-get update + sudo apt-get install -y expect-dev + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-tags: true + + - name: Check if version is tagged + id: get-tag + run: | + set +ea + git describe --exact-match HEAD + if [ $? -eq 0 ]; then + echo "deploy_tag=$(git describe --exact-match HEAD)" >> $GITHUB_OUTPUT + else + echo "deploy_tag=FAILED" >> $GITHUB_OUTPUT + fi + + - name: Restore Yarn cache + uses: actions/cache@v4 + with: + path: .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup Yarn + run: corepack enable + + - name: Install Yarn Dependencies + run: | + unbuffer yarn install --immutable | tee yarn_output.log + if cat yarn_output.log | grep YN0060; then + echo "Detected incompatible peer dependencies!" + exit 1 + fi + + - name: Compile + if: steps.get-tag.outputs.deploy_tag != 'FAILED' + run: yarn run build --env GITHUB_CD --env GITHUB_SHA=$GITHUB_SHA --env GITHUB_TAG="${{ steps.get-tag.outputs.deploy_tag }}" + + - name: Compile (no tag) + if: steps.get-tag.outputs.deploy_tag == 'FAILED' + run: yarn run build --env GITHUB_CD --env GITHUB_SHA=$GITHUB_SHA + + #Safety against pushing broken code + - name: Run ESLint + run: yarn eslint "**/*.{js,jsx,ts,tsx}" + + - name: Create workdir + run: | + git fetch origin live + git worktree add $HOME/webpanellive origin/live + touch $HOME/webpanellive/.nojekyll + + - name: Copy files + run: | + export WEBPANEL_VERSION=$(node -pe "require('./package.json').version") + export API_VERSION=$(node -pe "require('./package.json').tgs_api_version") + rm -rf $HOME/webpanellive/api/$API_VERSION + rm -rf $HOME/webpanellive/webpanel/$WEBPANEL_VERSION + mkdir -p $HOME/webpanellive/webpanel/$WEBPANEL_VERSION + cp ./dist/* $HOME/webpanellive/webpanel/$WEBPANEL_VERSION -R + cd $HOME/webpanellive/api + ln -s ../webpanel/$WEBPANEL_VERSION $API_VERSION + + - name: Deploy to Github + if: steps.get-tag.outputs.deploy_tag != 'FAILED' + run: | + cd $HOME/webpanellive + git config --local user.email "161980869+tgstation-server-ci[bot]@users.noreply.github.com" + git config --local user.name "tgstation-server-ci[bot]" + git add * + git commit -m "Update webpanel" + git pull --rebase origin live + git push origin HEAD:live diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 00000000..be05216e --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,74 @@ +name: Node.js CI + +on: + push: + branches: + - next + - graphql + pull_request: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Restore Yarn cache + uses: actions/cache@v4 + with: + path: .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup Yarn + run: corepack enable + + - name: Install Yarn Dependencies + run: | + unbuffer yarn install --immutable | tee yarn_output.log + if cat yarn_output.log | grep YN0060; then + echo "Detected incompatible peer dependencies!" + exit 1 + fi + + - name: Compile + run: yarn build + + lint: + name: Run Linter + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Restore Yarn cache + uses: actions/cache@v4 + with: + path: .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup Yarn + run: corepack enable + + - name: Install Dependencies + run: yarn + + - name: Run ESLint + run: yarn eslint "**/*.{js,jsx,ts,tsx}" diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml new file mode 100644 index 00000000..61665655 --- /dev/null +++ b/.github/workflows/chromatic.yml @@ -0,0 +1,42 @@ +name: "Chromatic" + +on: + push: + branches: + - next + - graphql + +jobs: + chromatic: + name: Run Chromatic + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Restore Yarn cache + uses: actions/cache@v4 + with: + path: .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Setup Yarn + run: corepack enable + + - name: Install Dependencies + run: yarn + + - name: Run Chromatic + uses: chromaui/action@latest + with: + projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} diff --git a/.github/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml similarity index 97% rename from .github/dependabot-automerge.yml rename to .github/workflows/dependabot-automerge.yml index 60884747..6f94a152 100644 --- a/.github/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -5,6 +5,7 @@ on: types: [opened, reopened] branches: - next + - graphql concurrency: group: "dependabot-automerge-${{ github.head_ref || github.run_id }}-${{ github.event_name }}" diff --git a/package.json b/package.json index dc184027..1639b624 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "preview": "vite preview", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", - "chromatic": "npx chromatic --project-token=chpt_d91fb89186cb623" + "chromatic": "npx chromatic" }, "dependencies": { "concurrently": "^9.0.1", diff --git a/src/App.css b/src/App.css deleted file mode 100644 index c452c4d6..00000000 --- a/src/App.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - background: #212529; - color: #FFFFFF; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; -} -p { - text-align: center; -} diff --git a/src/components/utils/Loading.stories.tsx b/src/components/utils/Loading.stories.tsx index efd94c45..25004d97 100644 --- a/src/components/utils/Loading.stories.tsx +++ b/src/components/utils/Loading.stories.tsx @@ -9,4 +9,7 @@ const config: Meta = { export default config; export const NoText = () => ; -export const LoadingText = () => ; +export const TranslatedLoadingText = () => ( + +); +export const UntranslatedText = () => ; diff --git a/src/components/utils/Loading.tsx b/src/components/utils/Loading.tsx index 34471283..a63a3764 100644 --- a/src/components/utils/Loading.tsx +++ b/src/components/utils/Loading.tsx @@ -1,19 +1,26 @@ -import { Loader2 } from "lucide-react" +import { Loader2 } from "lucide-react"; import { FormattedMessage } from "react-intl"; interface IProps { - messageId?: string + message?: string; + noIntl?: boolean; } const Loading = function (props: IProps) { return ( -
- - {props.messageId ?

- -

: null} -
- ) - } +
+ + {props.message ? ( +

+ {props.noIntl ? ( + props.message + ) : ( + + )} +

+ ) : null} +
+ ); +}; export default Loading; diff --git a/src/index.css b/src/index.css index b5c61c95..3c7c815c 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,12 @@ @tailwind base; @tailwind components; @tailwind utilities; + +body { + background: #212529; + color: #FFFFFF; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; +} +p { + text-align: center; +}