starting more for flow state quote

This commit is contained in:
talksik
2022-05-09 06:48:31 -05:00
parent 82a11d1833
commit 113e5b514f
4 changed files with 28 additions and 8 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
"port": "4001", "port": "4001",
"loggerPort": "9002", "loggerPort": "9002",
"mainConfig": "./webpack.main.config.js", "mainConfig": "./webpack.main.config.js",
"devContentSecurityPolicy": "connect-src 'self' https://zenquotes.io/api http://localhost:5000 ws://localhost:5000 'unsafe-eval'", "devContentSecurityPolicy": "connect-src 'self' http://localhost:5000 ws://localhost:5000 'unsafe-eval'",
"renderer": { "renderer": {
"config": "./webpack.renderer.config.js", "config": "./webpack.renderer.config.js",
"entryPoints": [ "entryPoints": [
@@ -103,13 +103,13 @@ export default function LineRow({
if (masterLineData.currentUserMember.lastVisitDate) if (masterLineData.currentUserMember.lastVisitDate)
return ( return (
<span className={`text-gray-400 ml-auto text-xs font-semibold`}> <span className={`text-gray-400 ml-auto text-xs font-semibold`}>
{moment(masterLineData.currentUserMember.lastVisitDate).fromNow()} {moment(masterLineData.currentUserMember.lastVisitDate).fromNow(true)}
</span> </span>
); );
return ( return (
<span className={`text-gray-300 ml-auto text-xs `}> <span className={`text-gray-300 ml-auto text-xs `}>
{moment(masterLineData.currentUserMember.lastVisitDate).fromNow()} {moment(masterLineData.currentUserMember.lastVisitDate).fromNow(true)}
</span> </span>
); );
}, [masterLineData]); }, [masterLineData]);
+1 -1
View File
@@ -40,7 +40,7 @@ type DesktopMode = "flowState" | "overlayOnly" | "terminal";
export const $desktopMode = atom<DesktopMode>({ export const $desktopMode = atom<DesktopMode>({
key: "DESKTOP_MODE", key: "DESKTOP_MODE",
default: "terminal", default: "flowState",
}); });
export const $selectedLineId = atom<string>({ export const $selectedLineId = atom<string>({
+24 -4
View File
@@ -8,7 +8,7 @@ import Channels, {
DEFAULT_APP_PRESET, DEFAULT_APP_PRESET,
Dimensions, Dimensions,
} from "../../electron/constants"; } from "../../electron/constants";
import { useCallback, useEffect } from "react"; import { useCallback, useEffect, useState } from "react";
import { useRecoilState, useRecoilValue } from "recoil"; import { useRecoilState, useRecoilValue } from "recoil";
import { LineDataProvider } from "../../controller/lineDataProvider"; import { LineDataProvider } from "../../controller/lineDataProvider";
@@ -96,16 +96,36 @@ export default function NirvanaRouter() {
); );
} }
type Quote = { q: string; a: string; h?: string };
function FlowState() { function FlowState() {
const [quote, setQuote] = useState<Quote>(null);
useEffect(() => { useEffect(() => {
fetch("http://zenquotes.io/api/random", { method: "GET" }) fetch("https://zenquotes.io/api/random")
.then((res) => { .then((res) => {
console.log(res); console.log(res);
return res.json();
}) })
.catch(() => { .then((data: any) => {
console.warn(data);
// setQuote(res[0]);
})
.catch((error) => {
// do nothing, don't bother user, just don't show the quote // do nothing, don't bother user, just don't show the quote
console.warn(error);
}); });
}, []); }, []);
return <>{}</>; return (
<div className="flex flex-row flex-1 justify-center items-center">
{quote && (
<span className="flex flex-col justify-center items-center">
<span className="text-xl text-gray-800 font-semibold">{quote.q}</span>
<span className="tex-md italic text-gray-400">{quote.a}</span>
</span>
)}
</div>
);
} }