Skip to content

Commit

Permalink
fix: version tracking regression
Browse files Browse the repository at this point in the history
  • Loading branch information
OldStarchy committed Jul 23, 2024
1 parent 106ae28 commit 464e604
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` tsc -b && vite build && yarn sentry:sourcemaps",
"build": "VITE_GIT_SHA=`git rev-parse --short HEAD` tsc -b && vite build && yarn sentry:sourcemaps",
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org nicholas-sorokin --project pandemic-tracker ./dist && sentry-cli sourcemaps upload --org nicholas-sorokin --project pandemic-tracker ./dist"
Expand Down
12 changes: 5 additions & 7 deletions src/components/layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import { Popup } from '../Popup';
import { Button } from '../common/Button';
import { H2, H3, Link, Span } from '../common/Typography';

const devMode = import.meta.env.NODE_ENV === 'development';

export function MainLayout({ children }: { children: ReactNode }) {
const [showWhatsNew, setShowWhatsNew] = useState(() => {
const dismissed = localStorage.getItem('whats_new.version_dismissed');
const sha = import.meta.env.REACT_APP_GIT_SHA;
const sha = import.meta.env.VITE_GIT_SHA;
const shouldShow = dismissed !== (sha ?? 'dev');
return shouldShow;
});
Expand All @@ -24,8 +22,8 @@ export function MainLayout({ children }: { children: ReactNode }) {

newIssueLink.searchParams.append(
'body',
(import.meta.env.REACT_APP_GIT_SHA
? `Version: ${import.meta.env.REACT_APP_GIT_SHA}\n\n`
(import.meta.env.VITE_GIT_SHA
? `Version: ${import.meta.env.VITE_GIT_SHA}\n\n`
: '') + '<!-- Write your issue here -->',
);

Expand Down Expand Up @@ -141,7 +139,7 @@ export function MainLayout({ children }: { children: ReactNode }) {
onClick={() => {
localStorage.setItem(
'whats_new.version_dismissed',
import.meta.env.REACT_APP_GIT_SHA ??
import.meta.env.VITE_GIT_SHA ??
'dev',
);
setShowWhatsNew(false);
Expand Down Expand Up @@ -177,7 +175,7 @@ export function MainLayout({ children }: { children: ReactNode }) {
<Link href={newIssueLink.toString()} target="_BLANK">
Report an issue or suggest a feature
</Link>
{devMode && <Span>Dev Mode</Span>}
{import.meta.env.DEV && <Span>Dev Mode</Span>}
</footer>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// <reference types="vite/client" />

interface ImportMetaEnv {
REACT_APP_GIT_SHA?: string;
VITE_GIT_SHA?: string;
}

0 comments on commit 464e604

Please sign in to comment.