mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-04 11:03:27 +00:00
tweaks
This commit is contained in:
parent
ee49b35cce
commit
780f89a1a3
|
@ -12,32 +12,32 @@ interface Props extends DefaultProps {
|
|||
}
|
||||
|
||||
export default function FileItem(props: Props) {
|
||||
const Shadow = () => {
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
'absolute opacity-100 transition-opacity duration-200 top-auto bottom-auto w-[64px] h-[40px] shadow-xl shadow-red-500',
|
||||
{ 'opacity-100': props.selected }
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
// const Shadow = () => {
|
||||
// return (
|
||||
// <div
|
||||
// className={clsx(
|
||||
// 'absolute opacity-100 transition-opacity duration-200 top-auto bottom-auto w-[64px] h-[40px] shadow-xl shadow-red-500',
|
||||
// { 'opacity-100': props.selected }
|
||||
// )}
|
||||
// />
|
||||
// );
|
||||
// };
|
||||
return (
|
||||
<div onClick={props.onClick} className="inline-block w-[100px] mb-3">
|
||||
<div onClick={props.onClick} className="inline-block w-[100px] mb-3" draggable>
|
||||
<div
|
||||
className={clsx(
|
||||
'border-2 border-transparent rounded-lg text-center w-[100px] h-[100px] mb-1',
|
||||
{
|
||||
'bg-gray-50 dark:bg-gray-550': props.selected
|
||||
'bg-gray-50 dark:bg-gray-750': props.selected
|
||||
}
|
||||
)}
|
||||
>
|
||||
{/* <Shadow /> */}
|
||||
{/* <div className="w-[65px] border border-gray-600 m-auto rounded-md h-[80px] bg-gray-650 relative shadow-md "> */}
|
||||
{props.folder ? (
|
||||
<div className="relative w-full h-full ">
|
||||
<div className="relative w-full h-full active:translate-y-[1px]">
|
||||
<img
|
||||
className="bottom-0 p-3 pt-[19px] active:translate-y-[1px] margin-auto z-90"
|
||||
className="bottom-0 p-3 pt-[19px] margin-auto z-90 pointer-events-none"
|
||||
src="svg/folder.svg"
|
||||
/>
|
||||
</div>
|
||||
|
@ -51,9 +51,9 @@ export default function FileItem(props: Props) {
|
|||
)}
|
||||
>
|
||||
<svg
|
||||
className="absolute top-0 left-0 fill-gray-150 dark:fill-gray-750"
|
||||
className="absolute top-0 left-0 pointer-events-none fill-gray-150 dark:fill-gray-550"
|
||||
width="65"
|
||||
height="81"
|
||||
height="85"
|
||||
viewBox="0 0 65 81"
|
||||
>
|
||||
<path d="M0 8C0 3.58172 3.58172 0 8 0H39.6863C41.808 0 43.8429 0.842855 45.3431 2.34315L53.5 10.5L62.6569 19.6569C64.1571 21.1571 65 23.192 65 25.3137V73C65 77.4183 61.4183 81 57 81H8C3.58172 81 0 77.4183 0 73V8Z" />
|
||||
|
@ -61,14 +61,14 @@ export default function FileItem(props: Props) {
|
|||
<svg
|
||||
width="22"
|
||||
height="22"
|
||||
className="absolute -right-[1px] z-10 fill-gray-50 dark:fill-gray-600"
|
||||
className="absolute top-1 -right-[1px] z-10 fill-gray-50 dark:fill-gray-500 pointer-events-none"
|
||||
viewBox="0 0 41 41"
|
||||
>
|
||||
<path d="M41.4116 40.5577H11.234C5.02962 40.5577 0 35.5281 0 29.3238V0L41.4116 40.5577Z" />
|
||||
</svg>
|
||||
<div className="absolute flex flex-col items-center justify-center w-full h-full">
|
||||
<img
|
||||
className="mt-2 margin-auto"
|
||||
className="mt-2 pointer-events-none margin-auto"
|
||||
width={40}
|
||||
height={40}
|
||||
src={`icons/${props.iconName}.svg`}
|
||||
|
|
|
@ -35,7 +35,7 @@ const columns = ensureIsColumns([
|
|||
{ column: 'Name', key: 'name', width: 280 } as const,
|
||||
{ column: 'Size', key: 'size_in_bytes', width: 120 } as const,
|
||||
{ column: 'Type', key: 'extension', width: 100 } as const
|
||||
// { column: 'Checksum', key: 'meta_checksum', width: 120 } as const
|
||||
// { column: 'Checksum', key: 'meta_integrity_hash', width: 120 } as const
|
||||
// { column: 'Tags', key: 'tags', width: 120 } as const
|
||||
]);
|
||||
|
||||
|
@ -213,7 +213,7 @@ const RenderCell: React.FC<{ colKey?: ColumnKey; dirId?: number; fileId?: number
|
|||
return <span className="text-xs text-left">{byteSize(Number(value || 0))}</span>;
|
||||
case 'extension':
|
||||
return <span className="text-xs text-left">{value.toLowerCase()}</span>;
|
||||
// case 'meta_checksum':
|
||||
// case 'meta_integrity_hash':
|
||||
// return <span className="truncate">{value}</span>;
|
||||
// case 'tags':
|
||||
// return renderCellWithIcon(MusicNoteIcon);
|
||||
|
|
|
@ -67,7 +67,7 @@ export const Inspector = () => {
|
|||
<Link className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<MetaItem title="Checksum" value={file?.meta_checksum as string} />
|
||||
<MetaItem title="Checksum" value={file?.meta_integrity_hash as string} />
|
||||
<Divider />
|
||||
<MetaItem title="Uri" value={file?.uri as string} />
|
||||
<Divider />
|
||||
|
|
|
@ -62,7 +62,7 @@ const Heading: React.FC<{}> = ({ children }) => (
|
|||
export const Sidebar: React.FC<SidebarProps> = (props) => {
|
||||
const locations = useLocations();
|
||||
return (
|
||||
<div className="flex flex-col flex-wrap flex-shrink-0 min-h-full px-3 py-1 border-r border-gray-100 w-46 bg-gray-50 dark:bg-gray-850 dark:border-gray-950">
|
||||
<div className="flex flex-col flex-wrap flex-shrink-0 min-h-full px-3 py-1 border-r border-gray-100 w-46 bg-gray-50 dark:bg-gray-850 dark:border-gray-600">
|
||||
<div data-tauri-drag-region className="mt-2 mb-1 -ml-1 ">
|
||||
<TrafficLights
|
||||
onClose={appWindow.close}
|
||||
|
|
|
@ -11,7 +11,7 @@ interface StatItemProps {
|
|||
|
||||
const StatItem: React.FC<StatItemProps> = (props) => {
|
||||
return (
|
||||
<div className="flex flex-col p-4 mt-2 rounded-md bg-gray-50 dark:bg-gray-650">
|
||||
<div className="flex flex-col p-4 mt-2 rounded-md shadow-md bg-gray-50 dark:bg-gray-600">
|
||||
<span className="text-sm text-gray-400">{props.name}</span>
|
||||
<span className="text-2xl font-bold">
|
||||
{props.value}
|
||||
|
@ -25,13 +25,14 @@ export const OverviewScreen: React.FC<{}> = (props) => {
|
|||
const [selectedFile, setSelectedFile] = useState<null | string>(null);
|
||||
|
||||
function handleSelect(key: string) {
|
||||
if (selectedFile === key) setSelectedFile(null);
|
||||
// if (selectedFile === key) setSelectedFile(null);
|
||||
// else setSelectedFile(key);
|
||||
setSelectedFile(key);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col w-full h-full px-5 py-3">
|
||||
{/* <div className="flex flex-wrap space-x-2">
|
||||
<div className="flex flex-wrap space-x-2">
|
||||
<StatItem name="Total capacity" value="26.5" unit="TB" />
|
||||
<StatItem name="Index size" value="103" unit="MB" />
|
||||
<StatItem name="Preview media" value="23.5" unit="GB" />
|
||||
|
@ -39,7 +40,7 @@ export const OverviewScreen: React.FC<{}> = (props) => {
|
|||
<StatItem name="Total at-risk" value="1.5" unit="TB" />
|
||||
<StatItem name="Total backed up" value="25.3" unit="TB" />
|
||||
</div>
|
||||
<hr className="my-5 dark:border-gray-600" /> */}
|
||||
<hr className="my-5 dark:border-gray-600" />
|
||||
|
||||
<div className="mt-2 space-x-1">
|
||||
<FileItem
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ImageMeta, VideoMeta } from './media';
|
|||
|
||||
export interface IFile {
|
||||
id: number;
|
||||
meta_checksum: string;
|
||||
meta_integrity_hash: string;
|
||||
uri: string;
|
||||
is_dir: string;
|
||||
|
||||
|
|
3
packages/core/bindings/Client.ts
Normal file
3
packages/core/bindings/Client.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import type { Platform } from "./Platform";
|
||||
|
||||
export interface Client { id: number, name: string, platform: Platform, online: boolean, last_seen: string, timezone: string | null, date_created: string, }
|
|
@ -1,2 +1,2 @@
|
|||
|
||||
export type ClientEvent = { type: "NewFileTypeThumb", data: { file_id: number, icon_created: boolean, } } | { type: "NewJobCreated", data: { job_id: number, progress: number, } };
|
||||
export type ClientEvent = { type: "NewFileTypeThumb", data: { file_id: number, icon_created: boolean, } } | { type: "NewJobCreated", data: { job_id: number, progress: number, } } | { type: "DatabaseDisconnected", data: { reason: string | null, } };
|
|
@ -1,3 +1,3 @@
|
|||
import type { Encryption } from "./Encryption";
|
||||
|
||||
export interface File { id: number, meta_checksum: string, uri: string, is_dir: boolean, name: string, extension: string, size_in_bytes: string, library_id: number, date_created: string, date_modified: string, date_indexed: string, encryption: Encryption, ipfs_id: string | null, storage_device_id: number | null, capture_device_id: number | null, parent_id: number | null, }
|
||||
export interface File { id: number, meta_integrity_hash: string, sampled_byte_integrity_hash: string | null, byte_integrity_hash: string | null, uri: string, is_dir: boolean, name: string, extension: string, size_in_bytes: string, library_id: number, date_created: string, date_modified: string, date_indexed: string, encryption: Encryption, ipfs_id: string | null, location_id: number | null, capture_device_id: number | null, parent_id: number | null, }
|
2
packages/core/bindings/Location.ts
Normal file
2
packages/core/bindings/Location.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
export interface Location { id: number, name: string, total_capacity: number, available_capacity: number, is_removable: boolean, is_ejectable: boolean, is_root_filesystem: boolean, is_online: boolean, library_id: number, client_id: number, date_created: string, last_indexed: string, }
|
3
packages/core/bindings/LocationPaths.ts
Normal file
3
packages/core/bindings/LocationPaths.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import type { PathRule } from "./PathRule";
|
||||
|
||||
export interface LocationPaths { id: number, path: string, rule: PathRule, location_id: number, date_created: string, date_modified: string, }
|
2
packages/core/bindings/PathRule.ts
Normal file
2
packages/core/bindings/PathRule.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
export type PathRule = "Exclude" | "NoWatch";
|
2
packages/core/bindings/Platform.ts
Normal file
2
packages/core/bindings/Platform.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
export type Platform = "Unknown" | "MacOS" | "Windows" | "Linux" | "IOS" | "Android";
|
|
@ -17,7 +17,10 @@ pub struct Model {
|
|||
pub id: u32,
|
||||
// pub buffer_checksum: String,
|
||||
#[sea_orm(unique)]
|
||||
pub meta_checksum: String,
|
||||
pub meta_integrity_hash: String,
|
||||
pub sampled_byte_integrity_hash: Option<String>,
|
||||
pub byte_integrity_hash: Option<String>,
|
||||
|
||||
pub uri: String,
|
||||
pub is_dir: bool,
|
||||
// metadata
|
||||
|
|
|
@ -17,7 +17,6 @@ pub struct Model {
|
|||
#[sea_orm(primary_key)]
|
||||
pub id: u32,
|
||||
pub name: String,
|
||||
pub path: String, // C:\ or /Volumes/MyDrive
|
||||
pub total_capacity: u32,
|
||||
pub available_capacity: u32,
|
||||
pub is_removable: bool,
|
||||
|
|
|
@ -38,8 +38,9 @@ CREATE TABLE IF NOT EXISTS files (
|
|||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
uri TEXT NOT NULL,
|
||||
is_dir BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
meta_checksum TEXT NOT NULL UNIQUE ON CONFLICT IGNORE,
|
||||
buffer_checksum TEXT,
|
||||
meta_integrity_hash TEXT NOT NULL UNIQUE ON CONFLICT IGNORE,
|
||||
sampled_byte_integrity_hash TEXT NOT NULL,
|
||||
byte_integrity_hash TEXT NOT NULL,
|
||||
name TEXT,
|
||||
extension TEXT,
|
||||
size_in_bytes TEXT NOT NULL,
|
||||
|
|
|
@ -28,6 +28,6 @@ pub async fn create_buffer_checksum(path: &str) -> io::Result<String> {
|
|||
Ok(hex)
|
||||
}
|
||||
|
||||
pub fn create_meta_checksum(uri: &str, size_in_bytes: u64) -> io::Result<String> {
|
||||
pub fn create_meta_integrity_hash(uri: &str, size_in_bytes: u64) -> io::Result<String> {
|
||||
Ok(digest(format!("{}{}", uri, size_in_bytes.to_string())))
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::db::{connection::DB_INSTANCE, entity::file, entity::location_paths, entity::locations};
|
||||
use crate::file::{checksum::create_meta_checksum, init};
|
||||
use crate::file::{checksum::create_meta_integrity_hash, init};
|
||||
use crate::util::time;
|
||||
use anyhow::Result;
|
||||
use chrono::Utc;
|
||||
|
@ -154,8 +154,8 @@ fn create_active_file_model(
|
|||
) -> Result<file::ActiveModel> {
|
||||
let metadata = fs::metadata(&uri)?;
|
||||
let size = metadata.len();
|
||||
let mut meta_checksum = create_meta_checksum(uri.to_str().unwrap_or_default(), size)?;
|
||||
meta_checksum.truncate(20);
|
||||
let mut meta_integrity_hash = create_meta_integrity_hash(uri.to_str().unwrap_or_default(), size)?;
|
||||
meta_integrity_hash.truncate(20);
|
||||
|
||||
let mut location_relative_uri = uri
|
||||
.to_str()
|
||||
|
@ -175,7 +175,7 @@ fn create_active_file_model(
|
|||
id: Set(*id),
|
||||
is_dir: Set(metadata.is_dir()),
|
||||
parent_id: Set(parent_id.map(|x| x.clone())),
|
||||
meta_checksum: Set(meta_checksum),
|
||||
meta_integrity_hash: Set(meta_integrity_hash),
|
||||
name: Set(extract_name(uri.file_stem())),
|
||||
extension: Set(extract_name(uri.extension())),
|
||||
encryption: Set(file::Encryption::None),
|
||||
|
|
|
@ -75,13 +75,13 @@ pub async fn create_location(path: &str) -> Result<()> {
|
|||
|
||||
let location = locations::ActiveModel {
|
||||
id: Set(next_location_id),
|
||||
client_id: Set(1),
|
||||
name: Set(Path::new(path)
|
||||
.file_name()
|
||||
.unwrap()
|
||||
.to_str()
|
||||
.unwrap()
|
||||
.to_owned()),
|
||||
path: Set(path.to_owned()),
|
||||
total_capacity: Set(mount.total_capacity.try_into().unwrap()),
|
||||
available_capacity: Set(mount.available_capacity.try_into().unwrap()),
|
||||
is_ejectable: Set(mount.is_ejectable),
|
||||
|
|
|
@ -41,9 +41,9 @@ module.exports = {
|
|||
400: '#9196A8',
|
||||
450: '#71758A',
|
||||
500: '#2E313B',
|
||||
550: '#1E1F25',
|
||||
550: '#20222d',
|
||||
600: '#171720',
|
||||
650: '#14141B',
|
||||
650: '#121219',
|
||||
700: '#121317',
|
||||
750: '#0D0E11',
|
||||
800: '#0C0C0F',
|
||||
|
|
Loading…
Reference in a new issue