Skip to content

Commit 067c0ec

Browse files
committed
feat: add favicon
1 parent 23eb3d3 commit 067c0ec

File tree

5 files changed

+188
-68
lines changed

5 files changed

+188
-68
lines changed

frontend/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ VITE_APP_SENTRY_PROJECT_ID="4506435887366144"
66
VITE_APP_POSTHOG_API_KEY=phc_6kfTNEAVw7rn1LA51cO3D69FefbKupSWFaM7OUgEpEo
77
VITE_APP_POSTHOG_HOST=https://ph.rivet.gg
88
VITE_APP_CLOUD_API_URL=https://cloud.rivet.gg/api
9+
DEPLOYMENT_TYPE=staging
910

1011
# Overridden in CI
1112
SENTRY_AUTH_TOKEN=

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
"estree-util-to-js": "^2.0.0",
107107
"fast-deep-equal": "^3.1.3",
108108
"fast-json-patch": "^3.1.1",
109+
"favigo": "^1.1.0",
109110
"file-saver": "^2.0.5",
110111
"filesize": "^11.0.2",
111112
"framer-motion": "^11.18.2",

frontend/src/lib/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const commonEnvSchema = z.object({
1414
SENTRY_AUTH_TOKEN: z.string().optional(),
1515
SENTRY_PROJECT: z.string().optional(),
1616
APP_TYPE: z.enum(["engine", "cloud", "inspector"]).optional(),
17+
DEPLOYMENT_TYPE: z.enum(["staging", "production"]).optional(),
1718
});
1819

1920
export const commonEnv = () => commonEnvSchema.parse(import.meta.env);

frontend/vite.engine.config.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from "node:path";
33
import { sentryVitePlugin } from "@sentry/vite-plugin";
44
import { tanstackRouter } from "@tanstack/router-plugin/vite";
55
import react from "@vitejs/plugin-react";
6+
import favigo from "favigo/vite";
67
import { defineConfig, loadEnv, type Plugin } from "vite";
78
import tsconfigPaths from "vite-tsconfig-paths";
89
import { commonEnvSchema } from "./src/lib/env";
@@ -11,6 +12,25 @@ import { commonEnvSchema } from "./src/lib/env";
1112
const GIT_BRANCH = process.env.CF_PAGES_BRANCH;
1213
const GIT_SHA = process.env.CF_PAGES_COMMIT_SHA;
1314

15+
16+
17+
const getVariantForMode = (mode: string) => {
18+
switch (mode) {
19+
case 'staging':
20+
return {
21+
type: 'badge',
22+
text: 'DEV',
23+
backgroundColor: '#FF4F00',
24+
textColor: '#ffffff',
25+
position: 'bottom-right',
26+
size: 'large',
27+
} as const
28+
default:
29+
return undefined
30+
}
31+
}
32+
33+
1434
// https://vitejs.dev/config/
1535
export default defineConfig(({ mode }) => {
1636
const env = commonEnvSchema.parse(loadEnv(mode, process.cwd(), ""));
@@ -33,6 +53,14 @@ export default defineConfig(({ mode }) => {
3353
: undefined,
3454
})
3555
: null,
56+
favigo({
57+
source: "./public/favicon.svg",
58+
variant: getVariantForMode(env.DEPLOYMENT_TYPE || 'production'),
59+
configuration: {
60+
theme_color: "#FF4F00",
61+
background: "transparent",
62+
}
63+
}),
3664
],
3765
server: {
3866
port: 43708,

0 commit comments

Comments
 (0)