Clear up index
This commit is contained in:
parent
439de6a264
commit
0ab6984cdf
11 changed files with 44 additions and 66 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { VersionEvent } from "../lib/types";
|
import type { VersionEvent } from "../lib/view-types";
|
||||||
import {
|
import {
|
||||||
absoluteTime,
|
absoluteTime,
|
||||||
formatBytes
|
formatBytes
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,9 @@
|
||||||
formatBytes,
|
formatBytes,
|
||||||
type View
|
type View
|
||||||
} from "../lib/stores.svelte";
|
} from "../lib/stores.svelte";
|
||||||
import type {
|
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
|
||||||
DocumentVersionWithoutContent,
|
import type { VaultHistoryResponse } from "../lib/types/VaultHistoryResponse";
|
||||||
VaultHistoryResponse,
|
import type { VersionEvent, TreeNode } from "../lib/view-types";
|
||||||
VersionEvent,
|
|
||||||
TreeNode
|
|
||||||
} from "../lib/types";
|
|
||||||
import FileTree from "./FileTree.svelte";
|
import FileTree from "./FileTree.svelte";
|
||||||
import ActivityFeed from "./ActivityFeed.svelte";
|
import ActivityFeed from "./ActivityFeed.svelte";
|
||||||
import DocumentDetail from "./DocumentDetail.svelte";
|
import DocumentDetail from "./DocumentDetail.svelte";
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,9 @@
|
||||||
isImageFile,
|
isImageFile,
|
||||||
fileExtension
|
fileExtension
|
||||||
} from "../lib/stores.svelte";
|
} from "../lib/stores.svelte";
|
||||||
import type {
|
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
|
||||||
DocumentVersionWithoutContent,
|
import type { DocumentVersion } from "../lib/types/DocumentVersion";
|
||||||
DocumentVersion,
|
import type { ActionType } from "../lib/view-types";
|
||||||
ActionType
|
|
||||||
} from "../lib/types";
|
|
||||||
import DiffView from "./DiffView.svelte";
|
import DiffView from "./DiffView.svelte";
|
||||||
import ConfirmDialog from "./ConfirmDialog.svelte";
|
import ConfirmDialog from "./ConfirmDialog.svelte";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { TreeNode } from "../lib/types";
|
import type { TreeNode } from "../lib/view-types";
|
||||||
import FileTree from "./FileTree.svelte";
|
import FileTree from "./FileTree.svelte";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { DocumentVersionWithoutContent } from "../lib/types";
|
import type { DocumentVersionWithoutContent } from "../lib/types/DocumentVersionWithoutContent";
|
||||||
import { relativeTime, absoluteTime } from "../lib/stores.svelte";
|
import { relativeTime, absoluteTime } from "../lib/stores.svelte";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { auth } from "../lib/stores.svelte";
|
import { auth } from "../lib/stores.svelte";
|
||||||
import { relativeTime } from "../lib/stores.svelte";
|
import { relativeTime } from "../lib/stores.svelte";
|
||||||
import type { VaultInfo } from "../lib/types";
|
import type { VaultInfo } from "../lib/types/VaultInfo";
|
||||||
|
|
||||||
function select(vault: VaultInfo) {
|
function select(vault: VaultInfo) {
|
||||||
auth.selectVault(vault.name);
|
auth.selectVault(vault.name);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
import type {
|
import type { DocumentUpdateResponse } from "./types/DocumentUpdateResponse";
|
||||||
DocumentUpdateResponse,
|
import type { DocumentVersion } from "./types/DocumentVersion";
|
||||||
DocumentVersion,
|
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
|
||||||
DocumentVersionWithoutContent,
|
import type { FetchLatestDocumentsResponse } from "./types/FetchLatestDocumentsResponse";
|
||||||
FetchLatestDocumentsResponse,
|
import type { ListVaultsResponse } from "./types/ListVaultsResponse";
|
||||||
ListVaultsResponse,
|
import type { PingResponse } from "./types/PingResponse";
|
||||||
PingResponse,
|
import type { VaultHistoryResponse } from "./types/VaultHistoryResponse";
|
||||||
VaultHistoryResponse
|
|
||||||
} from "./types";
|
|
||||||
|
|
||||||
async function fetchJsonWithToken<T>(
|
async function fetchJsonWithToken<T>(
|
||||||
path: string,
|
path: string,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
import { ApiClient } from "./api";
|
import { ApiClient } from "./api";
|
||||||
import type {
|
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
|
||||||
DocumentVersionWithoutContent,
|
import type { VaultInfo } from "./types/VaultInfo";
|
||||||
VaultInfo,
|
import type { VersionEvent, ActionType, TreeNode } from "./view-types";
|
||||||
VersionEvent,
|
|
||||||
ActionType,
|
|
||||||
TreeNode
|
|
||||||
} from "./types";
|
|
||||||
|
|
||||||
class AuthStore {
|
class AuthStore {
|
||||||
token = $state("");
|
token = $state("");
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import type { DocumentVersionWithoutContent } from "./DocumentVersionWithoutContent";
|
|
||||||
|
|
||||||
export type { DocumentUpdateResponse } from "./DocumentUpdateResponse";
|
|
||||||
export type { DocumentVersion } from "./DocumentVersion";
|
|
||||||
export type { DocumentVersionWithoutContent } from "./DocumentVersionWithoutContent";
|
|
||||||
export type { FetchLatestDocumentsResponse } from "./FetchLatestDocumentsResponse";
|
|
||||||
export type { ListVaultsResponse } from "./ListVaultsResponse";
|
|
||||||
export type { PingResponse } from "./PingResponse";
|
|
||||||
export type { VaultInfo } from "./VaultInfo";
|
|
||||||
export type { VaultHistoryResponse } from "./VaultHistoryResponse";
|
|
||||||
|
|
||||||
export type ActionType =
|
|
||||||
| "created"
|
|
||||||
| "updated"
|
|
||||||
| "renamed"
|
|
||||||
| "deleted"
|
|
||||||
| "restored";
|
|
||||||
|
|
||||||
export interface VersionEvent extends DocumentVersionWithoutContent {
|
|
||||||
action: ActionType;
|
|
||||||
previousPath?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TreeNode {
|
|
||||||
name: string;
|
|
||||||
path: string;
|
|
||||||
isFolder: boolean;
|
|
||||||
children: TreeNode[];
|
|
||||||
document?: DocumentVersionWithoutContent;
|
|
||||||
isDeleted?: boolean;
|
|
||||||
}
|
|
||||||
22
frontend/history-ui/src/lib/view-types.ts
Normal file
22
frontend/history-ui/src/lib/view-types.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import type { DocumentVersionWithoutContent } from "./types/DocumentVersionWithoutContent";
|
||||||
|
|
||||||
|
export type ActionType =
|
||||||
|
| "created"
|
||||||
|
| "updated"
|
||||||
|
| "renamed"
|
||||||
|
| "deleted"
|
||||||
|
| "restored";
|
||||||
|
|
||||||
|
export interface VersionEvent extends DocumentVersionWithoutContent {
|
||||||
|
action: ActionType;
|
||||||
|
previousPath?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TreeNode {
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
isFolder: boolean;
|
||||||
|
children: TreeNode[];
|
||||||
|
document?: DocumentVersionWithoutContent;
|
||||||
|
isDeleted?: boolean;
|
||||||
|
}
|
||||||
|
|
@ -8,12 +8,10 @@ cd sync-server
|
||||||
cargo test export_bindings
|
cargo test export_bindings
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
# sync-client/src/services/types contains only generated bindings — wipe and copy
|
# Both target directories contain only generated bindings — wipe and copy
|
||||||
rm -f frontend/sync-client/src/services/types/*.ts
|
rm -f frontend/sync-client/src/services/types/*.ts
|
||||||
|
rm -f frontend/history-ui/src/lib/types/*.ts
|
||||||
cp -r sync-server/bindings/* frontend/sync-client/src/services/types/
|
cp -r sync-server/bindings/* frontend/sync-client/src/services/types/
|
||||||
|
|
||||||
# history-ui/src/lib/types contains generated bindings plus a hand-written index.ts
|
|
||||||
find frontend/history-ui/src/lib/types -maxdepth 1 -name "*.ts" ! -name "index.ts" -delete
|
|
||||||
cp -r sync-server/bindings/* frontend/history-ui/src/lib/types/
|
cp -r sync-server/bindings/* frontend/history-ui/src/lib/types/
|
||||||
|
|
||||||
cd frontend
|
cd frontend
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue