Skip to content

Commit b8b9808

Browse files
author
n3kosempai
committed
[release] version 1.2.0
- better performance in my Apps. - added sumarize to every app on my Apps. -
1 parent 73966c8 commit b8b9808

8 files changed

Lines changed: 268 additions & 195 deletions

File tree

io.github.N3kosempai.klia-store.metainfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<binary>klia-store</binary>
3434
</provides>
3535
<releases>
36-
<release version="1.1.0" date="2025-01-18">
36+
<release version="1.2.0" date="2025-01-18">
3737
<description>
3838
<p>New features and improvements:</p>
3939
<ul>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "klia-store",
33
"private": true,
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct InstalledApp {
99
app_id: String,
1010
name: String,
1111
version: String,
12+
summary: Option<String>,
1213
}
1314

1415
#[derive(Serialize)]
@@ -337,15 +338,15 @@ async fn get_installed_flatpaks(app: tauri::AppHandle) -> Result<Vec<InstalledAp
337338
// Inside flatpak, use flatpak-spawn to execute on the host
338339
shell
339340
.command("flatpak-spawn")
340-
.args(["--host", "flatpak", "list", "--app", "--columns=application,name,version"])
341+
.args(["--host", "flatpak", "list", "--app", "--columns=application,name,version,description"])
341342
.output()
342343
.await
343344
.map_err(|e| format!("Failed to execute flatpak-spawn: {}", e))?
344345
} else {
345346
// Outside flatpak, use flatpak directly
346347
shell
347348
.command("flatpak")
348-
.args(["list", "--app", "--columns=application,name,version"])
349+
.args(["list", "--app", "--columns=application,name,version,description"])
349350
.output()
350351
.await
351352
.map_err(|e| format!("Failed to execute flatpak: {}", e))?
@@ -367,6 +368,11 @@ async fn get_installed_flatpaks(app: tauri::AppHandle) -> Result<Vec<InstalledAp
367368
app_id: parts[0].trim().to_string(),
368369
name: parts[1].trim().to_string(),
369370
version: parts[2].trim().to_string(),
371+
summary: if parts.len() >= 4 && !parts[3].trim().is_empty() {
372+
Some(parts[3].trim().to_string())
373+
} else {
374+
None
375+
},
370376
})
371377
} else {
372378
None

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "klia-store",
4-
"version": "1.1.0",
4+
"version": "1.2.0",
55
"identifier": "io.github.N3kosempai.klia-store",
66
"build": {
77
"beforeDevCommand": "npm run dev",

src/hooks/useInstalledApps.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface InstalledAppRust {
88
app_id: string;
99
name: string;
1010
version: string;
11+
summary?: string;
1112
}
1213

1314
export const useInstalledApps = () => {
@@ -24,6 +25,7 @@ export const useInstalledApps = () => {
2425
appId: app.app_id,
2526
name: app.name,
2627
version: app.version,
28+
summary: app.summary,
2729
}));
2830

2931
setInstalledAppsInfo(installedAppsInfo);

src/pages/myApps/MyApps.tsx

Lines changed: 27 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { ArrowBack, Delete, Description, Update } from "@mui/icons-material";
1+
import { ArrowBack, Update } from "@mui/icons-material";
22
import {
33
Box,
44
Button,
5-
Card,
6-
CardContent,
75
Container,
86
Dialog,
97
DialogContent,
@@ -15,18 +13,19 @@ import { invoke } from "@tauri-apps/api/core";
1513
import { listen } from "@tauri-apps/api/event";
1614
import { useCallback, useEffect, useRef, useState } from "react";
1715
import { useTranslation } from "react-i18next";
18-
import { CachedImage } from "../../components/CachedImage";
1916
import { ReleaseNotesModal } from "../../components/ReleaseNotesModal";
2017
import { Terminal } from "../../components/Terminal";
2118
import { UpdateAllModal } from "../../components/UpdateAllModal";
2219
import type { InstalledAppInfo } from "../../store/installedAppsStore";
2320
import { useInstalledAppsStore } from "../../store/installedAppsStore";
2421
import { checkAvailableUpdates } from "../../utils/updateChecker";
22+
import { InstalledAppCard } from "./components/InstalledAppCard";
2523

2624
interface InstalledAppRust {
2725
app_id: string;
2826
name: string;
2927
version: string;
28+
summary?: string;
3029
}
3130

3231
interface MyAppsProps {
@@ -71,6 +70,11 @@ export const MyApps = ({ onBack }: MyAppsProps) => {
7170
const parentRef = useRef<HTMLDivElement>(null);
7271
const [itemsPerRow, setItemsPerRow] = useState(5);
7372

73+
// Fixed card height for consistent rendering
74+
const CARD_HEIGHT = 300;
75+
const ROW_GAP = 16; // 2 * 8px (gap: 2 in MUI)
76+
const ROW_HEIGHT = CARD_HEIGHT + ROW_GAP;
77+
7478
useEffect(() => {
7579
const updateItemsPerRow = () => {
7680
const width = window.innerWidth;
@@ -95,13 +99,8 @@ export const MyApps = ({ onBack }: MyAppsProps) => {
9599
const rowVirtualizer = useVirtualizer({
96100
count: rowCount,
97101
getScrollElement: () => parentRef.current,
98-
estimateSize: () => 340, // Estimated height of each row (increased for more spacing)
99-
overscan: 2,
100-
measureElement:
101-
typeof window !== "undefined" &&
102-
navigator.userAgent.indexOf("Firefox") === -1
103-
? undefined
104-
: () => 340, // Use fixed size to avoid scroll jumps
102+
estimateSize: () => ROW_HEIGHT,
103+
overscan: 5, // Increased for smoother scrolling
105104
});
106105

107106
const reloadInstalledApps = useCallback(async () => {
@@ -113,6 +112,7 @@ export const MyApps = ({ onBack }: MyAppsProps) => {
113112
appId: app.app_id,
114113
name: app.name,
115114
version: app.version,
115+
summary: app.summary,
116116
}));
117117

118118
setInstalledAppsInfo(installedAppsInfo);
@@ -474,7 +474,7 @@ export const MyApps = ({ onBack }: MyAppsProps) => {
474474
top: 0,
475475
left: 0,
476476
width: "100%",
477-
height: 340,
477+
height: CARD_HEIGHT,
478478
transform: `translateY(${virtualRow.start}px)`,
479479
display: "grid",
480480
gridTemplateColumns: {
@@ -485,188 +485,25 @@ export const MyApps = ({ onBack }: MyAppsProps) => {
485485
xl: "repeat(5, 1fr)",
486486
},
487487
gap: 2,
488-
pb: 2, // Padding bottom to separate rows
488+
mb: 2, // Margin bottom to separate rows
489489
}}
490490
>
491491
{rowApps.map((app) => (
492-
<Card
492+
<InstalledAppCard
493493
key={app.appId}
494-
sx={{
495-
display: "flex",
496-
flexDirection: "column",
497-
boxSizing: "border-box",
498-
minWidth: 0,
499-
overflow: "hidden",
500-
transition: "box-shadow 0.3s",
501-
"&:hover": { boxShadow: 6 },
502-
}}
503-
>
504-
<Box
505-
sx={{
506-
p: 2,
507-
display: "flex",
508-
flexDirection: "column",
509-
alignItems: "center",
510-
gap: 2,
511-
minHeight: 150,
512-
bgcolor: "background.paper",
513-
}}
514-
>
515-
{/* App Icon */}
516-
<Box
517-
sx={{
518-
width: 80,
519-
height: 80,
520-
flexShrink: 0,
521-
borderRadius: 2,
522-
overflow: "hidden",
523-
bgcolor: "grey.800",
524-
display: "flex",
525-
alignItems: "center",
526-
justifyContent: "center",
527-
}}
528-
>
529-
<CachedImage
530-
appId={app.appId}
531-
imageUrl={`https://dl.flathub.org/repo/appstream/x86_64/icons/128x128/${app.appId}.png`}
532-
alt={app.name}
533-
variant="rounded"
534-
style={{
535-
width: "100%",
536-
height: "100%",
537-
objectFit: "cover",
538-
}}
539-
/>
540-
</Box>
541-
542-
{/* App Name */}
543-
<Typography
544-
variant="body1"
545-
fontWeight="bold"
546-
textAlign="center"
547-
sx={{
548-
overflow: "hidden",
549-
textOverflow: "ellipsis",
550-
display: "-webkit-box",
551-
WebkitLineClamp: 2,
552-
WebkitBoxOrient: "vertical",
553-
minHeight: "2.5em",
554-
}}
555-
>
556-
{app.name}
557-
</Typography>
558-
</Box>
559-
560-
<CardContent sx={{ flexGrow: 1, pt: 1 }}>
561-
{/* App ID */}
562-
<Typography
563-
variant="caption"
564-
color="text.secondary"
565-
sx={{
566-
display: "block",
567-
mb: 1,
568-
overflow: "hidden",
569-
textOverflow: "ellipsis",
570-
whiteSpace: "nowrap",
571-
}}
572-
>
573-
{app.appId}
574-
</Typography>
575-
576-
{/* Version and Action Buttons */}
577-
<Box
578-
sx={{
579-
display: "flex",
580-
justifyContent: "space-between",
581-
alignItems: "center",
582-
gap: 1,
583-
}}
584-
>
585-
<Typography
586-
variant="caption"
587-
color="primary"
588-
sx={{
589-
fontWeight: "bold",
590-
}}
591-
>
592-
v{app.version}
593-
</Typography>
594-
595-
<Box
596-
sx={{
597-
display: "flex",
598-
alignItems: "center",
599-
gap: 0.5,
600-
}}
601-
>
602-
{/* Release Notes Icon - only show if update available */}
603-
{hasUpdate(app.appId) && (
604-
<IconButton
605-
size="small"
606-
onClick={() =>
607-
setSelectedAppForNotes(app.appId)
608-
}
609-
sx={{
610-
p: 0.5,
611-
"&:hover": {
612-
color: "primary.main",
613-
},
614-
}}
615-
>
616-
<Description fontSize="small" />
617-
</IconButton>
618-
)}
619-
620-
{/* Uninstall Icon */}
621-
<IconButton
622-
size="small"
623-
onClick={() => handleUninstall(app.appId)}
624-
disabled={
625-
isUninstalling &&
626-
uninstallingApp === app.appId
627-
}
628-
sx={{
629-
p: 0.5,
630-
bgcolor: "error.main",
631-
color: "white",
632-
"&:hover": {
633-
bgcolor: "error.dark",
634-
},
635-
"&.Mui-disabled": {
636-
bgcolor: "grey.500",
637-
color: "grey.300",
638-
},
639-
}}
640-
>
641-
<Delete fontSize="small" />
642-
</IconButton>
643-
644-
{/* Update Button - only show if update available */}
645-
{hasUpdate(app.appId) && (
646-
<Button
647-
variant="contained"
648-
size="small"
649-
onClick={() => handleUpdate(app.appId)}
650-
disabled={
651-
isUpdating && updatingApp === app.appId
652-
}
653-
sx={{
654-
minWidth: "auto",
655-
px: 1.5,
656-
py: 0.5,
657-
fontSize: "0.7rem",
658-
textTransform: "none",
659-
}}
660-
>
661-
{isUpdating && updatingApp === app.appId
662-
? t("appDetails.updating")
663-
: t("appDetails.update")}
664-
</Button>
665-
)}
666-
</Box>
667-
</Box>
668-
</CardContent>
669-
</Card>
494+
app={app}
495+
hasUpdate={hasUpdate(app.appId)}
496+
isUpdating={isUpdating && updatingApp === app.appId}
497+
isUninstalling={
498+
isUninstalling && uninstallingApp === app.appId
499+
}
500+
cardHeight={CARD_HEIGHT}
501+
onUpdate={() => handleUpdate(app.appId)}
502+
onUninstall={() => handleUninstall(app.appId)}
503+
onShowReleaseNotes={() =>
504+
setSelectedAppForNotes(app.appId)
505+
}
506+
/>
670507
))}
671508
</Box>
672509
);

0 commit comments

Comments
 (0)