diff --git a/kinode/packages/homepage/ui/index.html b/kinode/packages/homepage/ui/index.html index eb2f6b1a..9a21594d 100644 --- a/kinode/packages/homepage/ui/index.html +++ b/kinode/packages/homepage/ui/index.html @@ -9,6 +9,7 @@ + diff --git a/kinode/packages/homepage/ui/src/assets/logo.svg b/kinode/packages/homepage/ui/src/assets/logo.svg deleted file mode 100644 index ebbfb449..00000000 --- a/kinode/packages/homepage/ui/src/assets/logo.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/kinode/packages/homepage/ui/src/assets/select-chevron.svg b/kinode/packages/homepage/ui/src/assets/select-chevron.svg deleted file mode 100644 index 32010e12..00000000 --- a/kinode/packages/homepage/ui/src/assets/select-chevron.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/kinode/packages/homepage/ui/src/components/AllApps.tsx b/kinode/packages/homepage/ui/src/components/AllApps.tsx index 584f476b..a9c1b395 100644 --- a/kinode/packages/homepage/ui/src/components/AllApps.tsx +++ b/kinode/packages/homepage/ui/src/components/AllApps.tsx @@ -1,18 +1,10 @@ -import classNames from "classnames" import useHomepageStore from "../store/homepageStore" -import { isMobileCheck } from "../utils/dimensions" import AppDisplay from "./AppDisplay" -const AllApps: React.FC<{ expanded: boolean }> = ({ expanded }) => { +const AllApps: React.FC<{ expanded: boolean }> = () => { const { apps } = useHomepageStore() - const isMobile = isMobileCheck() - return
+ return
{apps.length === 0 ?
Loading apps...
: apps.map(app => )} diff --git a/kinode/packages/homepage/ui/src/components/AppDisplay.tsx b/kinode/packages/homepage/ui/src/components/AppDisplay.tsx index 05749cbc..a54eb26c 100644 --- a/kinode/packages/homepage/ui/src/components/AppDisplay.tsx +++ b/kinode/packages/homepage/ui/src/components/AppDisplay.tsx @@ -1,9 +1,5 @@ -import classNames from "classnames" import { HomepageApp } from "../store/homepageStore" -import { FaHeart, FaRegHeart, } from "react-icons/fa6" import { useState } from "react" -import usePersistentStore from "../store/persistentStore" -import { isMobileCheck } from "../utils/dimensions" import AppIconPlaceholder from "./AppIconPlaceholder" interface AppDisplayProps { @@ -11,42 +7,25 @@ interface AppDisplayProps { } const AppDisplay: React.FC = ({ app }) => { - const { favoriteApp, favoriteApps } = usePersistentStore(); const [isHovered, setIsHovered] = useState(false) - const isMobile = isMobileCheck() return setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} > {app?.base64_icon - ? + ? : }
{app?.label || app?.package_name}
{app?.path && isHovered && }
} diff --git a/kinode/packages/homepage/ui/src/components/AppIconPlaceholder.tsx b/kinode/packages/homepage/ui/src/components/AppIconPlaceholder.tsx index efcc5441..e18a9da4 100644 --- a/kinode/packages/homepage/ui/src/components/AppIconPlaceholder.tsx +++ b/kinode/packages/homepage/ui/src/components/AppIconPlaceholder.tsx @@ -1,9 +1,6 @@ import React from 'react'; -import { isMobileCheck } from '../utils/dimensions'; -import classNames from 'classnames'; - -const AppIconPlaceholder: React.FC<{ text: string, className?: string, size: 'small' | 'medium' | 'large' }> = ({ text, className, size }) => { +const AppIconPlaceholder: React.FC<{ text: string }> = ({ text }) => { const index = text.split('').pop()?.toUpperCase() || '0' const derivedFilename = `/icons/${index}` @@ -11,16 +8,7 @@ const AppIconPlaceholder: React.FC<{ text: string, className?: string, size: 'sm return null } - const isMobile = isMobileCheck() - - return + return } export default AppIconPlaceholder \ No newline at end of file diff --git a/kinode/packages/homepage/ui/src/components/AppsDock.tsx b/kinode/packages/homepage/ui/src/components/AppsDock.tsx index a66d000e..0185c0df 100644 --- a/kinode/packages/homepage/ui/src/components/AppsDock.tsx +++ b/kinode/packages/homepage/ui/src/components/AppsDock.tsx @@ -1,23 +1,14 @@ import useHomepageStore, { HomepageApp } from "../store/homepageStore" import AppDisplay from "./AppDisplay" -import usePersistentStore from "../store/persistentStore" import { useEffect, useState } from "react" -import { isMobileCheck } from "../utils/dimensions" -import classNames from "classnames" import { DragDropContext, Draggable, DropResult, Droppable } from 'react-beautiful-dnd' -import { getFetchUrl } from "../utils/fetch" const AppsDock: React.FC = () => { const { apps } = useHomepageStore() - const { favoriteApps, setFavoriteApps } = usePersistentStore() const [dockedApps, setDockedApps] = useState([]) useEffect(() => { let final: HomepageApp[] = [] - const dockedApps = Object.entries(favoriteApps) - .filter(([_, { favorite }]) => favorite) - .map(([name, { order }]) => ({ ...apps.find(a => a.package_name === name), order })) - .filter(a => a) as HomepageApp[] const orderedApps = dockedApps.filter(a => a.order !== undefined && a.order !== null) const unorderedApps = dockedApps.filter(a => a.order === undefined || a.order === null) @@ -27,11 +18,8 @@ const AppsDock: React.FC = () => { final = final.filter(a => a) unorderedApps.forEach(a => final.push(a)) - // console.log({ final }) setDockedApps(final) - }, [apps, favoriteApps]) - - const isMobile = isMobileCheck() + }, [apps]) // a little function to help us with reordering the result const reorder = (list: HomepageApp[], startIndex: number, endIndex: number) => { @@ -56,18 +44,7 @@ const AppsDock: React.FC = () => { const packageNames = items.map(app => app.package_name); - const faves = { ...favoriteApps } - - packageNames.forEach((name, i) => { - // console.log('setting order for', name, 'to', i) - faves[name].order = i - }) - - setFavoriteApps(faves) - - console.log({ favoriteApps }) - - fetch(getFetchUrl('/order'), { + fetch('/order', { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -84,13 +61,6 @@ const AppsDock: React.FC = () => {
0, - 'gap-4': !isMobile && dockedApps.length === 0, - 'mb-4': !isMobile, - 'gap-4 mb-2': isMobile, - 'flex-col': dockedApps.length === 0 - })} > {/*dockedApps.length === 0 ? app.package_name === 'app_store')!} /> diff --git a/kinode/packages/homepage/ui/src/components/ColorDot.tsx b/kinode/packages/homepage/ui/src/components/ColorDot.tsx deleted file mode 100644 index 5b0e91d8..00000000 --- a/kinode/packages/homepage/ui/src/components/ColorDot.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import classNames from 'classnames' -import React from 'react' -import { hexToRgb, hslToRgb, rgbToHex, rgbToHsl } from '../utils/colors' -import { isMobileCheck } from '../utils/dimensions' - -interface ColorDotProps extends React.HTMLAttributes { - num: string, -} - -const ColorDot: React.FC = ({ - num, - ...props -}) => { - const isMobile = isMobileCheck() - - num = (num || '').replace(/(0x|\.)/g, '') - - while (num.length < 6) { - num = '0' + num - } - - const leftHsl = rgbToHsl(hexToRgb(num.slice(0, 6))) - const rightHsl = rgbToHsl(hexToRgb(num.length > 6 ? num.slice(num.length - 6) : num)) - leftHsl.s = rightHsl.s = 1 - const leftColor = rgbToHex(hslToRgb(leftHsl)) - const rightColor = rgbToHex(hslToRgb(rightHsl)) - - const angle = (parseInt(num, 16) % 360) || -45 - - return ( -
-
- {props.children} -
- ) -} - -export default ColorDot diff --git a/kinode/packages/homepage/ui/src/components/Modal.tsx b/kinode/packages/homepage/ui/src/components/Modal.tsx index 557be306..9adfa8ba 100644 --- a/kinode/packages/homepage/ui/src/components/Modal.tsx +++ b/kinode/packages/homepage/ui/src/components/Modal.tsx @@ -1,6 +1,4 @@ import { FaX } from "react-icons/fa6" -import { isMobileCheck } from "../utils/dimensions" -import classNames from "classnames" interface Props extends React.HTMLAttributes { title: string @@ -8,19 +6,12 @@ interface Props extends React.HTMLAttributes { } export const Modal: React.FC = ({ title, onClose, children }) => { - const isMobile = isMobileCheck() return ( -
-
-
-

{title}

-
diff --git a/kinode/packages/homepage/ui/src/components/Widget.tsx b/kinode/packages/homepage/ui/src/components/Widget.tsx index bce038dc..ce399155 100644 --- a/kinode/packages/homepage/ui/src/components/Widget.tsx +++ b/kinode/packages/homepage/ui/src/components/Widget.tsx @@ -1,8 +1,5 @@ -import classNames from "classnames" import { useEffect, useState } from "react" -import usePersistentStore from "../store/persistentStore" import useHomepageStore from "../store/homepageStore" -import { isMobileCheck } from "../utils/dimensions" interface WidgetProps { package_name: string, @@ -10,32 +7,20 @@ interface WidgetProps { forceLarge?: boolean } -const Widget: React.FC = ({ package_name, widget, forceLarge }) => { +const Widget: React.FC = ({ package_name, widget }) => { const { apps } = useHomepageStore() - const { widgetSettings } = usePersistentStore() - const isMobile = isMobileCheck() - const isLarge = forceLarge || widgetSettings[package_name]?.size === "large" - const isSmall = !widgetSettings[package_name]?.size || widgetSettings[package_name]?.size === "small" - const [tallScreen, setTallScreen] = useState(window.innerHeight > window.innerWidth) + const [_tallScreen, setTallScreen] = useState(window.innerHeight > window.innerWidth) useEffect(() => { setTallScreen(window.innerHeight > window.innerWidth) }, [window.innerHeight, window.innerWidth]) - return
-
+ return
+
{apps.find(app => app.package_name === package_name)?.label || package_name}