Move basic functions

This commit is contained in:
Dustin Brett 2025-06-11 20:32:57 -07:00
parent 450f2d7659
commit 5936461246
4 changed files with 20 additions and 13 deletions

View File

@ -34,10 +34,7 @@ import {
type NsEntry,
type NsResponse,
} from "components/apps/Terminal/types";
import {
displayLicense,
displayVersion,
} from "components/apps/Terminal/useTerminal";
import { displayLicense } from "components/apps/Terminal/useTerminal";
import { resourceAliasMap } from "components/system/Dialogs/Run";
import extensions from "components/system/Files/FileEntry/extensions";
import {
@ -62,6 +59,7 @@ import {
} from "utils/constants";
import { transcode } from "utils/ffmpeg";
import {
displayVersion,
getExtension,
getTZOffsetISOString,
isFileSystemMappingSupported,

View File

@ -25,18 +25,17 @@ import { useProcesses } from "contexts/process";
import { useSession } from "contexts/session";
import useResizeObserver from "hooks/useResizeObserver";
import { HOME, PACKAGE_DATA, PREVENT_SCROLL } from "utils/constants";
import { getExtension, haltEvent, loadFiles } from "utils/functions";
import {
displayVersion,
getExtension,
haltEvent,
loadFiles,
} from "utils/functions";
const { alias, author, license, version } = PACKAGE_DATA;
const { alias, author, license } = PACKAGE_DATA;
export const displayLicense = `${license} License`;
export const displayVersion = (): string => {
const { __NEXT_DATA__: { buildId } = {} } = window;
return `${version}${buildId ? `-${buildId}` : ""}`;
};
const useTerminal = ({
containerRef,
id,

View File

@ -1,4 +1,5 @@
import { Component } from "react";
import { isDev } from "utils/functions";
type ErrorBoundaryProps = {
FallbackRender?: React.ReactNode;
@ -31,7 +32,7 @@ export class ErrorBoundary extends Component<
state: { hasError },
} = this;
if (hasError && !FallbackRender && !("__nextDevClientId" in window)) {
if (hasError && !FallbackRender && !isDev()) {
window.location.reload();
}

View File

@ -20,6 +20,7 @@ import {
MAX_RES_ICON_OVERRIDE,
MILLISECONDS_IN_SECOND,
ONE_TIME_PASSIVE_EVENT,
PACKAGE_DATA,
PREVENT_SCROLL,
SHORTCUT_EXTENSION,
SUPPORTED_ICON_SIZES,
@ -1222,3 +1223,11 @@ export const maybeRequestIdleCallback = (
callback();
}
};
export const displayVersion = (): string => {
const { __NEXT_DATA__: { buildId } = {} } = window;
return `${PACKAGE_DATA.version}${buildId ? `-${buildId}` : ""}`;
};
export const isDev = (): boolean => "__nextDevClientId" in window;