Skip to content

Commit d457811

Browse files
committed
feat(StatsView): Add upload/download icon for finished files
1 parent dffd5e5 commit d457811

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"aws-crt": "^1.12.1",
7676
"buffer": "^6.0.3",
7777
"builtin-modules": "3.3.0",
78+
"classnames": "^2.3.2",
7879
"crypto-browserify": "^3.12.0",
7980
"dropbox": "^10.28.0",
8081
"electron": "^18.3.15",

pnpm-lock.yaml

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

src/components/StatsView.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
flex: 0 0 auto;
7171
}
7272

73+
.list-item > .readonly {
74+
cursor: default;
75+
filter: invert(1);
76+
}
77+
7378
.icon {
7479
width: 16px;
7580
height: 16px;

src/components/StatsView.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as React from "react";
22
import { throttle } from 'lodash';
3+
import classnames from 'classnames';
34
import useStore, { LogType } from './store';
45
import styles from './StatsView.module.css';
5-
import { AlertTriangle, CheckCircle, ArrowDownUp, Activity, LineChart, ListChecks, Siren, FileType, ScrollText, Info, AlertCircle, XCircle, ChevronRight, Terminal, RedoDot } from 'lucide-react';
6+
import { AlertTriangle, CheckCircle, ArrowDownUp, Activity, LineChart, ListChecks, Siren, FileType, ScrollText, Info, AlertCircle, XCircle, ChevronRight, Terminal, RedoDot, UploadCloud, DownloadCloud } from 'lucide-react';
67
import { log } from '../moreOnLog'
78
import { Utils } from '../utils/utils';
89
import { Notice } from "obsidian";
@@ -21,6 +22,14 @@ const getIconByStatus = (status: string) => {
2122
return <div className={styles.loading}></div>
2223
}
2324

25+
const getIconByType = (type: string) => {
26+
if (type === 'TOLOCAL') {
27+
return <DownloadCloud className={styles['icon']} />
28+
}
29+
30+
return <UploadCloud className={styles['icon']} />
31+
}
32+
2433
export const StatsViewComponent = (props: { plugin: InvioPlugin }) => {
2534
const { record, logs, getPubJobList, getSyncJobList, getFinishedJobList, getFailJobList } = useStore();
2635
const logsRef = useRef(null);
@@ -129,6 +138,10 @@ export const StatsViewComponent = (props: { plugin: InvioPlugin }) => {
129138
<div key={job.key} className={styles['listItem']}>
130139
<FileType className={styles['icon']} />
131140
<span onClick={() => { openFile(job.key) }} className={styles['listItemLongSpan']} title="Click to show file contents">{job.key.split('/').slice(-1)[0]}</span>
141+
<span className={classnames(styles['listItemShortSpan'], styles['readonly'])}
142+
title={job.syncType === 'TOLOCAL' ? 'Download to local' : 'Upload to remote'}>
143+
{getIconByType(job.syncType)}
144+
</span>
132145
<span onClick={() => onCheckLink(job.remoteLink)} className={styles['listItemShortSpan']} title="Click to show remote url">{getIconByStatus(job.syncStatus)}</span>
133146
</div>
134147
)) : null}

0 commit comments

Comments
 (0)