Skip to content

Commit

Permalink
small improvements and version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
afadil committed Oct 27, 2024
1 parent 80a8887 commit b428a48
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 131 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wealthfolio-app",
"private": true,
"version": "1.0.19",
"version": "1.0.20",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wealthfolio-app"
version = "1.0.19"
version = "1.0.20"
description = "Portfolio tracker"
authors = ["Aziz Fadil"]
license = "LGPL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"productName": "Wealthfolio",
"mainBinaryName": "Wealthfolio",
"version": "1.0.19",
"version": "1.0.20",
"identifier": "com.teymz.wealthfolio",
"plugins": {
"updater": {
Expand Down
1 change: 0 additions & 1 deletion src/commands/activity-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const createActivities = async (activities: NewActivity[]): Promise<numbe
try {
switch (getRunEnv()) {
case RUN_ENV.DESKTOP:
console.log('create_activities', activities);
return invokeTauri('create_activities', { activities });
default:
throw new Error(`Unsupported`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,61 +35,52 @@ export function ImportMappingPreviewTable({
invalidSymbols,
}: ImportMappingPreviewTableProps) {
return (
<div className="h-full w-full overflow-hidden rounded-md border text-sm">
<div className="grid h-full" style={{ gridTemplateRows: 'auto 1fr' }}>
{/* Sticky Header */}
<div className="overflow-hidden">
<Table>
<TableHeader>
<TableRow>
<TableHead className="sticky left-0 z-30 w-[50px] min-w-16 border-r bg-background">
#
<div className="h-full w-full overflow-auto">
<div className="inline-block min-w-full">
<Table>
<TableHeader className="sticky top-0 z-20 bg-background">
<TableRow>
<TableHead className="sticky left-0 z-30 w-[50px] min-w-[50px] border-r border-border bg-background">
#
</TableHead>
{importFormatFields.map((field) => (
<TableHead key={field} className="min-w-16 whitespace-nowrap">
{renderHeaderCell({
field,
mapping,
headers,
handleColumnMapping,
})}
</TableHead>
{importFormatFields.map((field) => (
<TableHead key={field} className="min-w-16">
{renderHeaderCell({
field,
mapping,
headers,
handleColumnMapping,
})}
</TableHead>
))}
</TableRow>
</TableHeader>
</Table>
</div>

{/* Scrollable Body */}
<div className="overflow-auto">
<Table>
<TableBody>
{rowsToShow.map((rowNum) => {
const row = csvData[rowNum - 1];
return (
<TableRow key={`row-${rowNum}`}>
<TableCell className="sticky left-0 z-20 w-[50px] min-w-16 border-r bg-background">
{rowNum}
))}
</TableRow>
</TableHeader>
<TableBody>
{rowsToShow.map((rowNum) => {
const row = csvData[rowNum - 1];
return (
<TableRow key={`row-${rowNum}`}>
<TableCell className="sticky left-0 z-20 w-[50px] border-r bg-background">
{rowNum}
</TableCell>
{importFormatFields.map((field) => (
<TableCell key={field} className="min-w-[50px]">
{renderCell({
field,
row,
mapping,
getMappedValue,
handleActivityTypeMapping,
handleSymbolMapping,
invalidSymbols,
})}
</TableCell>
{importFormatFields.map((field) => (
<TableCell key={field} className="w-[50px] min-w-16">
{renderCell({
field,
row,
mapping,
getMappedValue,
handleActivityTypeMapping,
handleSymbolMapping,
invalidSymbols,
})}
</TableCell>
))}
</TableRow>
);
})}
</TableBody>
</Table>
</div>
))}
</TableRow>
);
})}
</TableBody>
</Table>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function renderHeaderCell({

return (
<div>
<div className="flex items-center gap-2 px-4 pb-0 pt-2">
<div className="flex items-center gap-2 pb-0 pt-2">
<span className="font-bold">{field}</span>
</div>
{isEditing ? (
Expand All @@ -53,7 +53,7 @@ export function renderHeaderCell({
value={mappedHeader || SKIP_FIELD_VALUE}
onOpenChange={(open) => !open && setEditingHeader(null)}
>
<SelectTrigger className="h-8 w-full px-3 py-2 text-sm font-normal text-muted-foreground">
<SelectTrigger className="h-8 w-full py-2 text-sm font-normal text-muted-foreground">
<SelectValue placeholder={isRequired ? 'Select column' : 'Optional'} />
</SelectTrigger>
<SelectContent className="max-h-[300px] overflow-y-auto">
Expand All @@ -76,7 +76,7 @@ export function renderHeaderCell({
<Button
type="button"
variant="ghost"
className="h-8 py-0 font-normal text-muted-foreground"
className="h-8 py-0 pl-0 font-normal text-muted-foreground"
onClick={() => setEditingHeader(field)}
>
{mappedHeader || (isRequired ? 'Select column' : 'Ignore')}
Expand Down
22 changes: 12 additions & 10 deletions src/pages/activity/import/components/import-mapping-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ export function ImportMappingTable(props: ImportMappingTableProps) {
}

return (
<Card>
<Card className="flex flex-col">
<Tabs
value={activeTab}
onValueChange={(value) => setActiveTab(value as 'preview' | 'raw')}
className="flex h-full flex-col space-y-4"
className="flex flex-1 flex-col"
>
<CardHeader>
<div className="flex items-center justify-between">
Expand All @@ -177,16 +177,18 @@ export function ImportMappingTable(props: ImportMappingTableProps) {
</div>
</CardHeader>

<CardContent>
<TabsContent value="preview" className="m-0 h-[500px] min-h-0 flex-1">
<ImportMappingPreviewTable
{...props}
rowsToShow={rowsToShow}
invalidSymbols={invalidSymbols}
/>
<CardContent className="flex-1 p-0">
<TabsContent value="preview" className="m-0 flex h-[500px] flex-col border-0">
<div className="flex-1 overflow-hidden">
<ImportMappingPreviewTable
{...props}
rowsToShow={rowsToShow}
invalidSymbols={invalidSymbols}
/>
</div>
</TabsContent>

<TabsContent value="raw">
<TabsContent value="raw" className="m-0 border-0">
<ImportMappingRawTable headers={props.headers} csvData={props.csvData} />
</TabsContent>
</CardContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ export function useActivityImportMutations({
description: 'Activities have been imported successfully.',
});
},
onError: (error: any) => {
console.log('error', error);
onError: () => {
toast({
title: 'Uh oh! Something went wrong.',
description: 'Please try again or report an issue if the problem persists.',
Expand Down
112 changes: 55 additions & 57 deletions src/pages/activity/import/import-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export function ActivityImportForm({
enabled: !!mapping.accountId,
});

console.log('fetchedMapping', fetchedMapping);

// Update mapping when fetched mapping is available
useEffect(() => {
if (fetchedMapping) {
Expand Down Expand Up @@ -227,39 +225,39 @@ export function ActivityImportForm({
});

return (
<div className="flex flex-col">
<div className="flex flex-col gap-2">
<Accordion
type="single"
value={accordionValue}
onValueChange={setAccordionValue}
collapsible
className="shadow-xs rounded-md border bg-card px-4"
>
<AccordionItem value="setup" className="border-none">
<AccordionTrigger className="text-base font-medium hover:no-underline">
Account & File Selection
</AccordionTrigger>
<AccordionContent>
<div className="flex flex-col gap-2 pt-2">
<AccountSelection
value={mapping.accountId}
onChange={(id) => updateMapping({ accountId: id })}
accounts={accounts}
/>
<FileDropzone
getRootProps={getRootProps}
getInputProps={getInputProps}
isDragActive={isDragActive}
selectedFile={selectedFile}
isLoading={isLoading}
openFilePicker={openFilePicker}
/>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>

<div className="flex flex-col gap-4">
<Accordion
type="single"
value={accordionValue}
onValueChange={setAccordionValue}
collapsible
className="shadow-xs rounded-md border bg-card px-4"
>
<AccordionItem value="setup" className="border-none">
<AccordionTrigger className="text-base font-medium hover:no-underline">
Account & File Selection
</AccordionTrigger>
<AccordionContent>
<div className="flex flex-col gap-2 pt-2">
<AccountSelection
value={mapping.accountId}
onChange={(id) => updateMapping({ accountId: id })}
accounts={accounts}
/>
<FileDropzone
getRootProps={getRootProps}
getInputProps={getInputProps}
isDragActive={isDragActive}
selectedFile={selectedFile}
isLoading={isLoading}
openFilePicker={openFilePicker}
/>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>

<div className="max-w-[1200px]">
<PreviewContent
accountId={mapping.accountId}
selectedFile={selectedFile}
Expand All @@ -275,30 +273,30 @@ export function ActivityImportForm({
getMappedValue={getMappedValue}
validationErrors={validationErrors}
/>
</div>

<div className="flex shrink-0 gap-4 pt-4">
<Button asChild variant="outline">
<Link to="/activities">Cancel</Link>
<div className="flex shrink-0 gap-4">
<Button asChild variant="outline">
<Link to="/activities">Cancel</Link>
</Button>
{mapping.accountId && selectedFile && isMapComplete() && (
<Button onClick={handleImport} disabled={saveAndCheckImportMutation.isPending}>
{saveAndCheckImportMutation.isPending ? (
<>
<Icons.Spinner className="mr-2 h-4 w-4 animate-spin" />
<span>Importing...</span>
</>
) : (
<span>Import Data</span>
)}
</Button>
{mapping.accountId && selectedFile && isMapComplete() && (
<Button onClick={handleImport} disabled={saveAndCheckImportMutation.isPending}>
{saveAndCheckImportMutation.isPending ? (
<>
<Icons.Spinner className="mr-2 h-4 w-4 animate-spin" />
<span>Importing...</span>
</>
) : (
<span>Import Data</span>
)}
</Button>
)}
{mapping.accountId && selectedFile && !isMapComplete() && (
<p className="flex items-center text-sm text-red-400">
<Icons.AlertTriangle className="mr-2 h-4 w-4" />
Please map all columns and activity types before importing.
</p>
)}
</div>
)}
{mapping.accountId && selectedFile && !isMapComplete() && (
<p className="flex items-center text-sm text-red-400">
<Icons.AlertTriangle className="mr-2 h-4 w-4" />
Please map all columns and activity types before importing.
</p>
)}
</div>
</div>
);
Expand Down
1 change: 0 additions & 1 deletion src/pages/asset/useAssetProfileMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const useAssetProfileMutations = () => {
const updateAssetProfileMutation = useMutation({
mutationFn: updateAssetProfile,
onSuccess: (result) => {
console.log('Asset profile update result:', result);
handleSuccess('Asset profile updated successfully.', result.id);
},
onError: (error) => {
Expand Down

0 comments on commit b428a48

Please sign in to comment.