Skip to content

Commit

Permalink
OG Tags, Dark/Light Mode Themes, & Fix CI-CD Environments (#87)
Browse files Browse the repository at this point in the history
* build(deps): Bump undici from 5.25.3 to 5.26.3 (#86)
* feat: Dark/Light Theme Toggle & Router Refactoring (#85)
* feat: Open Graph Tags
* cs: Migrate all `StyledLink` definitions to a single component
* cs: Refactor routing architecture
* ci: Tag DEV deployments
* ci: Use postbuild script to clone OpenAPI doc
* docs: Update README.md for Dark Mode
  • Loading branch information
amattu2 authored Oct 18, 2023
1 parent e43d69a commit 5545aec
Show file tree
Hide file tree
Showing 62 changed files with 499 additions and 401 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PUBLIC_URL=""
REACT_APP_NAME=""
REACT_APP_URL=""
REACT_APP_DESCRIPTION=""
REACT_APP_SLOGAN=""
REACT_APP_API_URL=""
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cloudflare-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
name: Publish to Cloudflare Pages
if: ${{ github.repository_owner == 'amattu2' }}
runs-on: ubuntu-latest
environment: better-vinwiki (Production)
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -35,6 +36,7 @@ jobs:
- name: Build
env:
REACT_APP_NAME: ${{ vars.REACT_APP_NAME }}
REACT_APP_URL: ${{ vars.REACT_APP_URL }}
REACT_APP_DESCRIPTION: ${{ vars.REACT_APP_DESCRIPTION }}
REACT_APP_SLOGAN: ${{ vars.REACT_APP_SLOGAN }}
REACT_APP_API_URL: ${{ vars.REACT_APP_API_URL }}
Expand All @@ -49,6 +51,6 @@ jobs:
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: vinwiki
projectName: better-vinwiki
directory: ./build
branch: main
33 changes: 31 additions & 2 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ permissions:
contents: read
pages: write
id-token: write
deployments: write

on:
workflow_dispatch:
push:
branches:
- development
- develop
- dev
paths:
- "src/**"
- "public/**"


jobs:
publish:
name: Publish to GitHub Pages
if: ${{ github.repository_owner == 'amattu2' }}
runs-on: ubuntu-latest
environment: better-vinwiki (Development)
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -42,6 +43,7 @@ jobs:
env:
PUBLIC_URL: ${{ vars.PUBLIC_URL }}
REACT_APP_NAME: ${{ vars.REACT_APP_NAME }}
REACT_APP_URL: ${{ vars.REACT_APP_URL }}
REACT_APP_DESCRIPTION: ${{ vars.REACT_APP_DESCRIPTION }}
REACT_APP_SLOGAN: ${{ vars.REACT_APP_SLOGAN }}
REACT_APP_API_URL: ${{ vars.REACT_APP_API_URL }}
Expand All @@ -58,6 +60,33 @@ jobs:
with:
path: './build'

- uses: chrnorm/deployment-action@v2
name: Create Deployment
id: deployment_create
with:
token: ${{ github.token }}
environment-url: ${{ vars.REACT_APP_URL }}
environment: better-vinwiki (Development)
ref: ${{ github.head_ref || github.ref_name }}

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

- name: Deployment - Success
if: success()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
environment-url: ${{ steps.deployment_create.outputs.environment_url }}
deployment-id: ${{ steps.deployment_create.outputs.deployment_id }}
state: 'success'

- name: Deployment - Failed
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
environment-url: ${{ steps.deployment_create.outputs.environment_url }}
deployment-id: ${{ steps.deployment_create.outputs.deployment_id }}
state: 'failure'
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ built with a cohesive user experience in mind.

Top Features:

- Modernized post feed with Trending Posts
- Individual post page with comments (Similar to Reddit)
- Dark Mode
- Modernized post feed with integrated comments
- Profile pages with comprehensive information on Activity, Vehicles, Lists, etc
- Vehicle diagnostic scan histories, VIN decoding, recall information, and more
- Vehicle diagnostic scan histories, VIN decoding, and recall information
- Enhanced bio and post content w/support for OBD-ii Codes, `@mentions`, `#VIN`,
and more
- Powerful list managment with bulk importing and exporting
Expand Down Expand Up @@ -54,8 +54,9 @@ Configuration Options (See [.env.example](./.env.example) for all options):

| Name | Description |
|:-|:-|
|`PUBLIC_URL`|The base URL for the application. Optional but useful for deployment under a subdirectory.|
|`PUBLIC_URL`|The base URL for the application. **Optional** unless deploying under a subdirectory.|
|`REACT_APP_NAME`|The name of the app. Used everywhere|
|`REACT_APP_URL`|The base URL for the application deployment location. **Required** for HTML5 meta tags|
|`REACT_APP_DESCRIPTION`|The description built into the HTML5 meta tags|
|`REACT_APP_SLOGAN`|Sits under the App Name on the auth pages|
|`REACT_APP_API_URL`|Base URL for the VINwiki API. Should have a trailing `/` at the end|
Expand All @@ -66,9 +67,8 @@ Configuration Options (See [.env.example](./.env.example) for all options):
See [src/config/AppConfig.ts](./src/config/AppConfig.ts) for the build defaults.
You likely will not want to leave them as the defaults.

> **Warning**: When using `PUBLIC_URL` for subdirectory deployments, some functionality may not work
> as expected. This app does not officially support subdirectory deployments. If you aren't deploying
> on a subdirectory, don't define this option.
> **Warning**: When using `PUBLIC_URL` for subdirectory deployments, but some functionality may not work
> as expected. This is the BASENAME of the url (e.g. `/subdirectory`)
# VINwiki REST API Docs

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && cp ./openapi.yml ./build",
"build": "react-scripts build",
"postbuild": "cp ./openapi.yml ./build",
"test": "react-scripts test",
"test:ci": "TZ=UTC CI=true react-scripts test --passWithNoTests",
"lint:ci": "eslint --ext .js,.jsx,.ts,.tsx src",
Expand Down
12 changes: 12 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
<meta charset="utf-8" />
<meta name="description" content="%REACT_APP_DESCRIPTION%" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<meta name="title" content="%REACT_APP_NAME%" />
<meta name="description" content="%REACT_APP_DESCRIPTION%" />
<meta property="og:type" content="website" />
<meta property="og:url" content="%REACT_APP_URL%" />
<meta property="og:title" content="%REACT_APP_NAME%" />
<meta property="og:description" content="%REACT_APP_DESCRIPTION%" />
<meta property="og:image" content="%REACT_APP_URL%/favicon.ico" />
<meta property="twitter:card" content="summary" />
<meta property="twitter:url" content="%REACT_APP_URL%" />
<meta property="twitter:title" content="%REACT_APP_NAME%" />
<meta property="twitter:description" content="%REACT_APP_DESCRIPTION%" />
<meta property="twitter:image" content="%REACT_APP_URL%/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
Expand Down
12 changes: 6 additions & 6 deletions src/components/ActionableCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ElementType, FC, Ref, forwardRef } from "react";
import { Card, CardHeader, CardActionArea, styled, CardProps } from "@mui/material";
import { Card, CardHeader, CardActionArea, styled, CardProps, Theme } from "@mui/material";
import { ArrowForwardIos } from "@mui/icons-material";

type Props = {
Expand All @@ -8,21 +8,21 @@ type Props = {
disabled?: boolean;
} & CardProps;

const StyledCard = styled(Card)({
const StyledCard = styled(Card)(({ theme }) => ({
padding: 0,
margin: 0,
borderRadius: 0,
border: "1px solid #ddd",
border: `1px solid ${theme.palette.divider}`,
borderRight: "unset",
borderTop: "unset",
"&:last-child": {
borderRadius: "0 0 8px 8px",
},
});
}));

const StyledCardHeader = styled(CardHeader)<{ component: ElementType, disabled?: boolean }>(({ disabled }) => ({
const StyledCardHeader = styled(CardHeader)<{ component: ElementType; disabled?: boolean; theme?: Theme }>(({ disabled, theme }) => ({
[disabled ? "& .MuiCardHeader-content .MuiTypography-root, & .MuiCardHeader-action" : ""]: {
color: "#ddd !important",
color: `${theme.palette.text.disabled} !important`,
},
"& .MuiCardHeader-action": {
alignSelf: "center",
Expand Down
6 changes: 3 additions & 3 deletions src/components/BlogPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ const StyledCard = styled(Card)({
overflow: "visible",
});

const StyledImageBox = styled(Paper)({
const StyledImageBox = styled(Paper)(({ theme }) => ({
height: "175px",
width: "175px",
overflow: "hidden",
borderRadius: "8px",
position: "relative",
background: "#ddd",
background: theme.palette.divider,
flexShrink: 0,
marginLeft: "-35px !important",
"&:hover .expand-button": {
opacity: 1,
},
});
}));

const StyledBackground = styled("div", {
shouldForwardProp: (p) => p !== "bg" && p !== "blur",
Expand Down
12 changes: 6 additions & 6 deletions src/components/CreateListDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ const StyledDialog = styled(Dialog)({
},
});

const StyledDialogContent = styled(DialogContent)({
backgroundColor: "#f4f7fa",
});
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
backgroundColor: theme.palette.modal.background,
}));

const StyledTextField = styled(TextField)({
const StyledTextField = styled(TextField)(({ theme }) => ({
marginTop: "16px",
"& .MuiInputBase-root": {
backgroundColor: "#fff",
backgroundColor: theme.palette.modal.contrast,
},
});
}));

/**
* A dialog that handles the creation of a Vehicle List
Expand Down
5 changes: 3 additions & 2 deletions src/components/CreatePost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Divider, IconButton, Stack, Step,
StepButton, StepContent,
Stepper, Tab, Tabs, TextField,
Theme,
Tooltip, Typography, styled,
} from "@mui/material";
import { DateTimePicker } from '@mui/x-date-pickers';
Expand Down Expand Up @@ -38,13 +39,13 @@ type PostForm = {
image: FileList;
};

const StyledCard = styled(Card, { shouldForwardProp: (p) => p !== "expanded" })(({ expanded }: { expanded?: boolean }) => ({
const StyledCard = styled(Card, { shouldForwardProp: (p) => p !== "expanded" })<{ expanded?: boolean, theme?: Theme }>(({ expanded = false, theme }) => ({
position: expanded ? "sticky" : "relative",
top: expanded ? "16px" : "unset",
padding: "16px 24px",
borderRadius: "8px",
margin: "8px 0",
border: "1px solid #e5e5e5",
border: `1px solid ${theme?.palette.divider}`,
zIndex: expanded ? 10 : "unset",
}));

Expand Down
12 changes: 6 additions & 6 deletions src/components/EditListDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ const StyledDialog = styled(Dialog)({
},
});

const StyledDialogContent = styled(DialogContent)({
backgroundColor: "#f4f7fa",
});
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
backgroundColor: theme.palette.modal.background,
}));

const StyledTextField = styled(TextField)({
const StyledTextField = styled(TextField)(({ theme }) => ({
marginTop: "16px",
"& .MuiInputBase-root": {
backgroundColor: "#fff",
backgroundColor: theme.palette.modal.contrast,
},
});
}));

/**
* A dialog that displays the edit form for a Vehicle List.
Expand Down
12 changes: 6 additions & 6 deletions src/components/EditProfileDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ const StyledDialog = styled(Dialog)({
},
});

const StyledDialogContent = styled(DialogContent)({
backgroundColor: "#f4f7fa",
});
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
backgroundColor: theme.palette.modal.background,
}));

const StyledTextField = styled(TextField)({
const StyledTextField = styled(TextField)(({ theme }) => ({
marginTop: "16px",
"& .MuiInputBase-root": {
backgroundColor: "#fff",
backgroundColor: theme.palette.modal.contrast,
},
});
}));

/**
* A dialog that displays the edit form for a profile.
Expand Down
6 changes: 3 additions & 3 deletions src/components/EditProfilePictureDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const StyledDialog = styled(Dialog)({
},
});

const StyledDialogContent = styled(DialogContent)({
backgroundColor: "#f4f7fa",
});
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
backgroundColor: theme.palette.modal.background,
}));

/**
* A dialog that displays the edit form for a profile picture.
Expand Down
12 changes: 6 additions & 6 deletions src/components/EditVehicleDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ const StyledDialog = styled(Dialog)({
},
});

const StyledDialogContent = styled(DialogContent)({
backgroundColor: "#f4f7fa",
});
const StyledDialogContent = styled(DialogContent)(({ theme }) => ({
backgroundColor: theme.palette.modal.background,
}));

const StyledTextField = styled(TextField)({
const StyledTextField = styled(TextField)(({ theme }) => ({
marginTop: "16px",
"& .MuiInputBase-root": {
backgroundColor: "#fff",
backgroundColor: theme.palette.modal.contrast,
},
});
}));

/**
* A dialog that displays the edit form for a vehicle.
Expand Down
6 changes: 3 additions & 3 deletions src/components/ExpandableImage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ type Props = {
alt: string;
};

const StyledImageBox = styled(Box)({
const StyledImageBox = styled(Box)(({ theme }) => ({
height: "100%",
width: "100%",
overflow: "hidden",
position: "relative",
background: "#ddd",
background: theme.palette.divider,
cursor: "pointer",
"&:hover .expand-button": {
opacity: 1,
},
});
}));

const StyledBackground = styled("div", {
shouldForwardProp: (p) => p !== "bg" && p !== "blur",
Expand Down
Loading

0 comments on commit 5545aec

Please sign in to comment.