|
|
|
@@ -3,19 +3,16 @@ import {
|
|
|
|
|
$maxNumberActiveStreams,
|
|
|
|
|
$numberActiveLines,
|
|
|
|
|
$selectedLineId,
|
|
|
|
|
} from "../../controller/recoil";
|
|
|
|
|
import Channels, {
|
|
|
|
|
DEFAULT_APP_PRESET,
|
|
|
|
|
Dimensions,
|
|
|
|
|
} from "../../electron/constants";
|
|
|
|
|
import { useCallback, useEffect, useState } from "react";
|
|
|
|
|
import { useRecoilState, useRecoilValue } from "recoil";
|
|
|
|
|
} from '../../controller/recoil';
|
|
|
|
|
import Channels, { DEFAULT_APP_PRESET, Dimensions } from '../../electron/constants';
|
|
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
|
import { useRecoilState, useRecoilValue } from 'recoil';
|
|
|
|
|
|
|
|
|
|
import FullMottoLogo from "../../../../components/logo/fullMotto";
|
|
|
|
|
import { LineDataProvider } from "../../controller/lineDataProvider";
|
|
|
|
|
import { LogoType } from "@nirvana/components/logo/full";
|
|
|
|
|
import NirvanaHeader from "../../components/header/index";
|
|
|
|
|
import NirvanaTerminal from "../terminal";
|
|
|
|
|
import FullMottoLogo from '../../../../components/logo/fullMotto';
|
|
|
|
|
import { LineDataProvider } from '../../controller/lineDataProvider';
|
|
|
|
|
import { LogoType } from '@nirvana/components/logo/full';
|
|
|
|
|
import NirvanaHeader from '../../components/header/index';
|
|
|
|
|
import NirvanaTerminal from '../terminal';
|
|
|
|
|
|
|
|
|
|
export default function NirvanaRouter() {
|
|
|
|
|
const [selectedLineId, setSelectedLineId] = useRecoilState($selectedLineId);
|
|
|
|
@@ -27,16 +24,16 @@ export default function NirvanaRouter() {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
// add dimensions if it's not overlay only mode
|
|
|
|
|
let finalDimensions: Dimensions = { height: 0, width: 0 };
|
|
|
|
|
let finalPosition: "center" | "topRight";
|
|
|
|
|
let finalPosition: 'center' | 'topRight';
|
|
|
|
|
|
|
|
|
|
const setAlwaysOnTop = desktopMode === "overlayOnly";
|
|
|
|
|
const setAlwaysOnTop = desktopMode === 'overlayOnly';
|
|
|
|
|
|
|
|
|
|
// go hunting for which dimensions to have
|
|
|
|
|
if (desktopMode === "terminal" || desktopMode == "flowState") {
|
|
|
|
|
if (desktopMode === 'terminal' || desktopMode == 'flowState') {
|
|
|
|
|
finalDimensions = DEFAULT_APP_PRESET;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (desktopMode === "overlayOnly") {
|
|
|
|
|
if (desktopMode === 'overlayOnly') {
|
|
|
|
|
finalDimensions = {
|
|
|
|
|
height: 68 + numberOfOverlayRows * 200,
|
|
|
|
|
width: 360 + 360 * numberOfOverlayColumns,
|
|
|
|
@@ -44,12 +41,12 @@ export default function NirvanaRouter() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(
|
|
|
|
|
"setting new dimensions",
|
|
|
|
|
'setting new dimensions',
|
|
|
|
|
desktopMode,
|
|
|
|
|
numberOfOverlayColumns,
|
|
|
|
|
numberOfOverlayRows,
|
|
|
|
|
finalDimensions,
|
|
|
|
|
setAlwaysOnTop
|
|
|
|
|
setAlwaysOnTop,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// send the final dimensions to main process
|
|
|
|
@@ -70,7 +67,7 @@ export default function NirvanaRouter() {
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
window.electronAPI.on(Channels.ON_WINDOW_BLUR, () => {
|
|
|
|
|
console.log(
|
|
|
|
|
"window blurring now, should be always on top and then ill tell main process to change dimensions"
|
|
|
|
|
'window blurring now, should be always on top and then ill tell main process to change dimensions',
|
|
|
|
|
);
|
|
|
|
|
// TODO: testing mode... uncomment both instructions below
|
|
|
|
|
// setDesktopMode("overlayOnly");
|
|
|
|
@@ -83,14 +80,14 @@ export default function NirvanaRouter() {
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-col flex-1">
|
|
|
|
|
<NirvanaHeader onHeaderFocus={() => setDesktopMode("terminal")} />
|
|
|
|
|
<NirvanaHeader onHeaderFocus={() => setDesktopMode('terminal')} />
|
|
|
|
|
|
|
|
|
|
{desktopMode === "flowState" && <FlowState />}
|
|
|
|
|
{desktopMode === 'flowState' && <FlowState />}
|
|
|
|
|
|
|
|
|
|
{/* remount nirvana terminal */}
|
|
|
|
|
{(desktopMode === "terminal" || desktopMode === "overlayOnly") && (
|
|
|
|
|
{(desktopMode === 'terminal' || desktopMode === 'overlayOnly') && (
|
|
|
|
|
<LineDataProvider>
|
|
|
|
|
<NirvanaTerminal overlayOnly={desktopMode === "overlayOnly"} />
|
|
|
|
|
<NirvanaTerminal overlayOnly={desktopMode === 'overlayOnly'} />
|
|
|
|
|
</LineDataProvider>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
@@ -109,7 +106,7 @@ function FlowState() {
|
|
|
|
|
const [quote, setQuote] = useState<Quote>(null);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetch("https://api.quotable.io/random")
|
|
|
|
|
fetch('https://api.quotable.io/random')
|
|
|
|
|
.then((res) => res.json())
|
|
|
|
|
.then((data: Quote) => {
|
|
|
|
|
console.warn(data);
|
|
|
|
@@ -125,16 +122,11 @@ function FlowState() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-col flex-1 justify-center items-center relative">
|
|
|
|
|
{/* <img src="https://source.unsplash.com/random/?nature" /> */}
|
|
|
|
|
<FullMottoLogo
|
|
|
|
|
type={LogoType.small}
|
|
|
|
|
className={"absolute bottom-2 mx-auto"}
|
|
|
|
|
/>
|
|
|
|
|
<FullMottoLogo type={LogoType.small} className={'absolute bottom-2 mx-auto'} />
|
|
|
|
|
|
|
|
|
|
{quote && (
|
|
|
|
|
<span className="flex flex-col justify-center items-center max-w-screen-sm">
|
|
|
|
|
<span className="text-xl text-gray-800 font-semibold text-center">
|
|
|
|
|
"{quote.content}"
|
|
|
|
|
</span>
|
|
|
|
|
<span className="text-xl text-gray-800 font-semibold text-center">"{quote.content}"</span>
|
|
|
|
|
<span className="tex-md italic text-gray-400">{quote.author}</span>
|
|
|
|
|
</span>
|
|
|
|
|
)}
|