Skip to content

Commit 1bb7b5a

Browse files
authored
Merge pull request #345 from kinode-dao/tm/appstore-flows
repair some missing appstore flows
2 parents eec1581 + e13a08f commit 1bb7b5a

File tree

18 files changed

+198
-144
lines changed

18 files changed

+198
-144
lines changed

kinode/packages/app_store/pkg/ui/assets/index-34EVhDFF.js

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kinode/packages/app_store/pkg/ui/assets/index-BxGs27ah.js

Lines changed: 0 additions & 94 deletions
This file was deleted.

kinode/packages/app_store/pkg/ui/assets/index-cJEV35Fc.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kinode/packages/app_store/pkg/ui/assets/index-umttRNrr.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

kinode/packages/app_store/pkg/ui/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
1515
<meta name="viewport"
1616
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" />
17-
<script type="module" crossorigin src="/main:app_store:sys/assets/index-BxGs27ah.js"></script>
18-
<link rel="stylesheet" crossorigin href="/main:app_store:sys/assets/index-umttRNrr.css">
17+
<script type="module" crossorigin src="/main:app_store:sys/assets/index-34EVhDFF.js"></script>
18+
<link rel="stylesheet" crossorigin href="/main:app_store:sys/assets/index-cJEV35Fc.css">
1919
</head>
2020

2121
<body>

kinode/packages/app_store/ui/src/components/ActionButton.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import DownloadButton from "./DownloadButton";
55
import InstallButton from "./InstallButton";
66
import LaunchButton from "./LaunchButton";
77
import { FaCheck } from "react-icons/fa6";
8+
import classNames from "classnames";
89

910
interface ActionButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
1011
app: AppInfo;
1112
isIcon?: boolean;
1213
}
1314

1415
export default function ActionButton({ app, isIcon = false, ...props }: ActionButtonProps) {
15-
const [incrementNumber, setIncrementNumber] = useState(0);
1616
const { installed, downloaded, updatable } = useMemo(() => {
1717
const versions = Object.entries(app?.metadata?.properties?.code_hashes || {});
1818
const latestHash = (versions.find(([v]) => v === app.metadata?.properties?.current_version) || [])[1];
@@ -29,7 +29,7 @@ export default function ActionButton({ app, isIcon = false, ...props }: ActionBu
2929
downloaded,
3030
updatable,
3131
};
32-
}, [app, incrementNumber]);
32+
}, [app]);
3333

3434

3535
const [launchPath, setLaunchPath] = useState('');
@@ -44,25 +44,33 @@ export default function ActionButton({ app, isIcon = false, ...props }: ActionBu
4444
}
4545
}
4646
})
47-
}, [app, incrementNumber])
47+
}, [app])
4848

4949
return (
5050
<>
5151
{(installed && launchPath)
5252
? <LaunchButton app={app} {...props} isIcon={isIcon} launchPath={launchPath} />
5353
: (installed && updatable)
54-
? <UpdateButton app={app} {...props} isIcon={isIcon} callback={() => setIncrementNumber(incrementNumber + 1)} />
54+
? <UpdateButton app={app} {...props} isIcon={isIcon} />
5555
: !downloaded
56-
? <DownloadButton app={app} {...props} isIcon={isIcon} callback={() => setIncrementNumber(incrementNumber + 1)} />
56+
? <DownloadButton app={app} {...props} isIcon={isIcon} />
5757
: !installed
58-
? <InstallButton app={app} {...props} isIcon={isIcon} callback={() => setIncrementNumber(incrementNumber + 1)} />
58+
? <InstallButton app={app} {...props} isIcon={isIcon} />
5959
: isIcon
6060
? <button
6161
className="pointer-events none icon clear absolute top-0 right-0"
6262
>
6363
<FaCheck />
6464
</button>
65-
: <div>Installed</div>}
65+
: <></>
66+
// <button
67+
// onClick={() => { }}
68+
// {...props as any}
69+
// className={classNames("clear pointer-events-none", props.className)}
70+
// >
71+
// Installed
72+
// </button>
73+
}
6674
</>
6775
);
6876
}

kinode/packages/app_store/ui/src/components/AppEntry.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ import { isMobileCheck } from "../utils/dimensions";
88
import classNames from "classnames";
99
import { useNavigate } from "react-router-dom";
1010
import { APP_DETAILS_PATH } from "../constants/path";
11+
import MoreActions from "./MoreActions";
1112

1213
interface AppEntryProps extends React.HTMLAttributes<HTMLDivElement> {
1314
app: AppInfo;
1415
size?: "small" | "medium" | "large";
1516
overrideImageSize?: "small" | "medium" | "large";
17+
showMoreActions?: boolean;
1618
}
1719

18-
export default function AppEntry({ app, size = "medium", overrideImageSize, ...props }: AppEntryProps) {
20+
export default function AppEntry({ app, size = "medium", overrideImageSize, showMoreActions, ...props }: AppEntryProps) {
1921
const isMobile = isMobileCheck()
2022
const navigate = useNavigate()
2123

@@ -27,17 +29,26 @@ export default function AppEntry({ app, size = "medium", overrideImageSize, ...p
2729
'flex-wrap gap-2': isMobile,
2830
'flex-col relative': size !== 'large'
2931
})}
30-
onClick={() => navigate(`/${APP_DETAILS_PATH}/${appId(app)}`)}
32+
onClick={() => {
33+
if (!showMoreActions) {
34+
navigate(`/${APP_DETAILS_PATH}/${appId(app)}`)
35+
}
36+
}}
3137
>
3238
<AppHeader app={app} size={size} overrideImageSize={overrideImageSize} />
3339
<ActionButton
3440
app={app}
35-
isIcon={size !== 'large'}
41+
isIcon={!showMoreActions && size !== 'large'}
3642
className={classNames({
37-
'absolute top-0 right-0': size !== 'large',
43+
'absolute': size !== 'large',
44+
'top-2 right-2': size !== 'large' && showMoreActions,
45+
'top-0 right-0': size !== 'large' && !showMoreActions,
3846
'bg-orange text-lg min-w-1/5': size === 'large',
3947
'ml-auto': size === 'large' && isMobile
4048
})} />
49+
{showMoreActions && <div className="absolute bottom-2 right-2">
50+
<MoreActions app={app} />
51+
</div>}
4152
</div>
4253
);
4354
}

kinode/packages/app_store/ui/src/components/AppHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ export default function AppHeader({
4747
alt="app icon"
4848
className={classNames('object-cover', {
4949
'rounded': !imageSize,
50-
'rounded-lg': imageSize === 'small',
51-
'rounded-xl': imageSize === 'medium',
50+
'rounded-md': imageSize === 'small',
51+
'rounded-lg': imageSize === 'medium',
5252
'rounded-2xl': imageSize === 'large',
5353
'h-32': imageSize === 'large' || imageSize === 'small',
5454
'h-20': imageSize === 'medium',
5555
})}
5656
/>
5757
: <ColorDot
58-
num={app.metadata_hash}
58+
num={app.metadata_hash || app.state?.our_version?.toString() || ''}
5959
dotSize={imageSize}
6060
/>}
6161
<div className={classNames("flex flex-col", {

kinode/packages/app_store/ui/src/components/ColorDot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const ColorDot: React.FC<ColorDotProps> = ({
1515
}) => {
1616
const isMobile = isMobileCheck()
1717

18-
num = (num || '').replace(/(0x|\.)/g, '')
18+
num = num ? num : '';
1919

2020
while (num.length < 6) {
2121
num = '0' + num

kinode/packages/app_store/ui/src/components/DownloadButton.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ import Modal from "./Modal";
55
import { getAppName } from "../utils/app";
66
import Loader from "./Loader";
77
import classNames from "classnames";
8-
import { useNavigate } from "react-router-dom";
98
import { FaDownload } from "react-icons/fa6";
109

1110
interface DownloadButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
1211
app: AppInfo;
1312
isIcon?: boolean;
14-
callback?: () => void;
1513
}
1614

17-
export default function DownloadButton({ app, isIcon = false, callback, ...props }: DownloadButtonProps) {
18-
const { downloadApp, getCaps, getMyApp } =
15+
export default function DownloadButton({ app, isIcon = false, ...props }: DownloadButtonProps) {
16+
const { downloadApp, getCaps, getMyApp, getMyApps } =
1917
useAppsStore();
2018
const [showModal, setShowModal] = useState(false);
2119
const [mirror, setMirror] = useState(app.metadata?.properties?.mirrors?.[0] || "Other");
@@ -50,7 +48,7 @@ export default function DownloadButton({ app, isIcon = false, callback, ...props
5048
setLoading("");
5149
setShowModal(false);
5250
clearInterval(interval);
53-
callback && callback();
51+
getMyApps();
5452
})
5553
.catch(console.log);
5654
}, 2000);

0 commit comments

Comments
 (0)