Skip to content

Commit 1682470

Browse files
committed
fix(favicon): lighter pink/yellow hues, fix CI env-flags naming check
- dev favicon: orange -> light pink - staging favicon: yellow -> lighter yellow (mark stays pixel-identical, background color only) - env-flags.ts's CI check requires every exported const to be is-/get- prefixed; deploymentEnv was a plain const. Converted to getDeploymentEnv(), matching the file's existing convention for non-boolean values (getCostMultiplier(), getAllowedIntegrationsFromEnv()).
1 parent f21eb25 commit 1682470

17 files changed

Lines changed: 31 additions & 28 deletions

apps/sim/ee/whitelabeling/metadata.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from 'next'
2-
import { deploymentEnv } from '@/lib/core/config/env-flags'
2+
import { getDeploymentEnv } from '@/lib/core/config/env-flags'
33
import { getBaseUrl, SITE_URL } from '@/lib/core/utils/urls'
44
import { getBrandConfig } from '@/ee/whitelabeling/branding'
55

@@ -13,14 +13,14 @@ interface FaviconSet {
1313
}
1414

1515
/**
16-
* Same "sim" wordmark per {@link deploymentEnv}, background color only —
16+
* Same "sim" wordmark per {@link getDeploymentEnv}, background color only —
1717
* so a dev/staging tab is never mistaken for prod at a glance. Ignored
1818
* entirely when `brand.faviconUrl` is set (a whitelabeled deployment's own
1919
* favicon always wins, regardless of which tier it's running on). Kept in
2020
* sync with `FAVICON_ICO_DESTINATIONS` in `next.config.ts`, which handles
2121
* the legacy `/favicon.ico` path the same way.
2222
*/
23-
const ICON_SETS: Record<typeof deploymentEnv, FaviconSet> = {
23+
const ICON_SETS: Record<ReturnType<typeof getDeploymentEnv>, FaviconSet> = {
2424
development: {
2525
svg: '/icon-dev.svg',
2626
favicon16: '/favicon-dev/favicon-16x16.png',
@@ -52,7 +52,7 @@ const ICON_SETS: Record<typeof deploymentEnv, FaviconSet> = {
5252
*/
5353
export function generateBrandedMetadata(override: Partial<Metadata> = {}): Metadata {
5454
const brand = getBrandConfig()
55-
const icons = ICON_SETS[deploymentEnv]
55+
const icons = ICON_SETS[getDeploymentEnv()]
5656

5757
const defaultTitle = brand.name
5858
const summaryFull = `Sim is the open-source AI workspace where teams build, deploy, and manage AI agents. Connect 1,000+ integrations and every major LLM to create agents that automate real work — visually, conversationally, or with code. Trusted by over 100,000 builders — from startups to Fortune 500 companies. SOC2 compliant.`

apps/sim/lib/core/config/env-flags.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,31 @@ export const isTest = env.NODE_ENV === 'test'
3030
* AWS Secrets Manager for dev/staging/production, so this reuses it rather
3131
* than inventing a second one.
3232
*/
33-
const rawDeploymentEnv =
34-
process.env.OTEL_DEPLOYMENT_ENVIRONMENT ||
35-
process.env.DEPLOYMENT_ENVIRONMENT ||
36-
(process.env.APPCONFIG_ENVIRONMENT === 'production'
37-
? 'prod'
38-
: process.env.APPCONFIG_ENVIRONMENT) ||
39-
env.NODE_ENV ||
40-
'development'
33+
function resolveRawDeploymentEnv(): string {
34+
return (
35+
process.env.OTEL_DEPLOYMENT_ENVIRONMENT ||
36+
process.env.DEPLOYMENT_ENVIRONMENT ||
37+
(process.env.APPCONFIG_ENVIRONMENT === 'production'
38+
? 'prod'
39+
: process.env.APPCONFIG_ENVIRONMENT) ||
40+
env.NODE_ENV ||
41+
'development'
42+
)
43+
}
4144

4245
/**
4346
* The deployment tier this build is running in, bucketed from
44-
* {@link rawDeploymentEnv} to a fixed three-way set for UI-facing branches —
45-
* currently just per-environment favicons, so it's obvious at a glance which
46-
* tab is prod vs. a staging/local build. See `ee/whitelabeling/metadata.ts`
47-
* and `next.config.ts`.
48-
*/
49-
export const deploymentEnv: 'development' | 'staging' | 'production' =
50-
rawDeploymentEnv === 'staging'
51-
? 'staging'
52-
: rawDeploymentEnv === 'prod' || rawDeploymentEnv === 'production'
53-
? 'production'
54-
: 'development'
47+
* {@link resolveRawDeploymentEnv} to a fixed three-way set for UI-facing
48+
* branches — currently just per-environment favicons, so it's obvious at a
49+
* glance which tab is prod vs. a staging/local build. See
50+
* `ee/whitelabeling/metadata.ts` and `next.config.ts`.
51+
*/
52+
export function getDeploymentEnv(): 'development' | 'staging' | 'production' {
53+
const raw = resolveRawDeploymentEnv()
54+
if (raw === 'staging') return 'staging'
55+
if (raw === 'prod' || raw === 'production') return 'production'
56+
return 'development'
57+
}
5558

5659
/**
5760
* Is this the hosted version of the application.

apps/sim/next.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'node:path'
22
import type { NextConfig } from 'next'
33
import { env, isTruthy } from './lib/core/config/env'
4-
import { deploymentEnv, isDev } from './lib/core/config/env-flags'
4+
import { getDeploymentEnv, isDev } from './lib/core/config/env-flags'
55
import {
66
getChatEmbedCSPPolicy,
77
getMainCSPPolicy,
@@ -33,7 +33,7 @@ const minimalRegistryAlias: Record<string, string> = useMinimalRegistry
3333
* `<link rel="icon">` tags Next renders from `generateBrandedMetadata()`
3434
* (`ee/whitelabeling/metadata.ts`) use the same per-environment set.
3535
*/
36-
const FAVICON_ICO_DESTINATIONS: Record<typeof deploymentEnv, string> = {
36+
const FAVICON_ICO_DESTINATIONS: Record<ReturnType<typeof getDeploymentEnv>, string> = {
3737
development: '/icon-dev.svg',
3838
staging: '/icon-staging.svg',
3939
production: '/icon.svg',
@@ -451,7 +451,7 @@ const nextConfig: NextConfig = {
451451
return [
452452
{
453453
source: '/favicon.ico',
454-
destination: FAVICON_ICO_DESTINATIONS[deploymentEnv],
454+
destination: FAVICON_ICO_DESTINATIONS[getDeploymentEnv()],
455455
},
456456
{
457457
source: '/r/:shortCode',
687 Bytes
Loading
678 Bytes
Loading
639 Bytes
Loading
46 Bytes
Loading
83 Bytes
Loading
83 Bytes
Binary file not shown.
321 Bytes
Loading

0 commit comments

Comments
 (0)