mirror of
https://github.com/DustinBrett/daedalOS.git
synced 2025-12-06 12:20:20 +01:00
Move basic functions
This commit is contained in:
parent
450f2d7659
commit
5936461246
|
|
@ -34,10 +34,7 @@ import {
|
||||||
type NsEntry,
|
type NsEntry,
|
||||||
type NsResponse,
|
type NsResponse,
|
||||||
} from "components/apps/Terminal/types";
|
} from "components/apps/Terminal/types";
|
||||||
import {
|
import { displayLicense } from "components/apps/Terminal/useTerminal";
|
||||||
displayLicense,
|
|
||||||
displayVersion,
|
|
||||||
} from "components/apps/Terminal/useTerminal";
|
|
||||||
import { resourceAliasMap } from "components/system/Dialogs/Run";
|
import { resourceAliasMap } from "components/system/Dialogs/Run";
|
||||||
import extensions from "components/system/Files/FileEntry/extensions";
|
import extensions from "components/system/Files/FileEntry/extensions";
|
||||||
import {
|
import {
|
||||||
|
|
@ -62,6 +59,7 @@ import {
|
||||||
} from "utils/constants";
|
} from "utils/constants";
|
||||||
import { transcode } from "utils/ffmpeg";
|
import { transcode } from "utils/ffmpeg";
|
||||||
import {
|
import {
|
||||||
|
displayVersion,
|
||||||
getExtension,
|
getExtension,
|
||||||
getTZOffsetISOString,
|
getTZOffsetISOString,
|
||||||
isFileSystemMappingSupported,
|
isFileSystemMappingSupported,
|
||||||
|
|
|
||||||
|
|
@ -25,18 +25,17 @@ import { useProcesses } from "contexts/process";
|
||||||
import { useSession } from "contexts/session";
|
import { useSession } from "contexts/session";
|
||||||
import useResizeObserver from "hooks/useResizeObserver";
|
import useResizeObserver from "hooks/useResizeObserver";
|
||||||
import { HOME, PACKAGE_DATA, PREVENT_SCROLL } from "utils/constants";
|
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 displayLicense = `${license} License`;
|
||||||
|
|
||||||
export const displayVersion = (): string => {
|
|
||||||
const { __NEXT_DATA__: { buildId } = {} } = window;
|
|
||||||
|
|
||||||
return `${version}${buildId ? `-${buildId}` : ""}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const useTerminal = ({
|
const useTerminal = ({
|
||||||
containerRef,
|
containerRef,
|
||||||
id,
|
id,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component } from "react";
|
import { Component } from "react";
|
||||||
|
import { isDev } from "utils/functions";
|
||||||
|
|
||||||
type ErrorBoundaryProps = {
|
type ErrorBoundaryProps = {
|
||||||
FallbackRender?: React.ReactNode;
|
FallbackRender?: React.ReactNode;
|
||||||
|
|
@ -31,7 +32,7 @@ export class ErrorBoundary extends Component<
|
||||||
state: { hasError },
|
state: { hasError },
|
||||||
} = this;
|
} = this;
|
||||||
|
|
||||||
if (hasError && !FallbackRender && !("__nextDevClientId" in window)) {
|
if (hasError && !FallbackRender && !isDev()) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import {
|
||||||
MAX_RES_ICON_OVERRIDE,
|
MAX_RES_ICON_OVERRIDE,
|
||||||
MILLISECONDS_IN_SECOND,
|
MILLISECONDS_IN_SECOND,
|
||||||
ONE_TIME_PASSIVE_EVENT,
|
ONE_TIME_PASSIVE_EVENT,
|
||||||
|
PACKAGE_DATA,
|
||||||
PREVENT_SCROLL,
|
PREVENT_SCROLL,
|
||||||
SHORTCUT_EXTENSION,
|
SHORTCUT_EXTENSION,
|
||||||
SUPPORTED_ICON_SIZES,
|
SUPPORTED_ICON_SIZES,
|
||||||
|
|
@ -1222,3 +1223,11 @@ export const maybeRequestIdleCallback = (
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const displayVersion = (): string => {
|
||||||
|
const { __NEXT_DATA__: { buildId } = {} } = window;
|
||||||
|
|
||||||
|
return `${PACKAGE_DATA.version}${buildId ? `-${buildId}` : ""}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isDev = (): boolean => "__nextDevClientId" in window;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user