2024-07-21 17:55:53 +02:00
|
|
|
import * as React from "bloatless-react";
|
2026-04-11 20:30:35 +00:00
|
|
|
import { SplitModal } from "./splitModal";
|
2026-04-08 21:03:36 +00:00
|
|
|
import { DirectoryItemList } from "../Components/directoryItemList";
|
2026-04-18 11:55:01 +00:00
|
|
|
import { DangerousActionButton } from "../Components/dangerousActionButton";
|
|
|
|
|
import StorageViewModel from "../../ViewModel/Global/storageViewModel";
|
2026-04-09 16:48:22 +00:00
|
|
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
2026-04-18 11:55:01 +00:00
|
|
|
import { PATH_COMPONENT_SEPARATOR } from "../../Model/Global/storageModel";
|
2026-04-08 21:03:36 +00:00
|
|
|
|
2026-04-09 16:48:22 +00:00
|
|
|
export function StorageModal(
|
|
|
|
|
coreViewModel: CoreViewModel,
|
|
|
|
|
storageViewModel: StorageViewModel,
|
|
|
|
|
) {
|
2026-04-08 21:03:36 +00:00
|
|
|
const detailView = React.createProxyState(
|
|
|
|
|
[storageViewModel.selectedPath],
|
|
|
|
|
() => {
|
|
|
|
|
if (storageViewModel.selectedPath.value == PATH_COMPONENT_SEPARATOR)
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<span class="secondary">
|
2026-04-09 16:48:22 +00:00
|
|
|
{coreViewModel.translations.storage.noItemSelected}
|
2026-04-08 21:03:36 +00:00
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
<hr></hr>
|
|
|
|
|
|
|
|
|
|
{DangerousActionButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel,
|
|
|
|
|
coreViewModel.translations.storage.removeJunkButton,
|
2026-04-08 21:03:36 +00:00
|
|
|
"delete_forever",
|
|
|
|
|
storageViewModel.removeJunk,
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div class="flex-column gap">
|
|
|
|
|
<div class="tile flex-no">
|
|
|
|
|
<div>
|
2026-04-09 16:48:22 +00:00
|
|
|
<b>{coreViewModel.translations.storage.path}</b>
|
2026-04-08 21:03:36 +00:00
|
|
|
<span
|
|
|
|
|
class="break-all"
|
|
|
|
|
subscribe:innerText={
|
|
|
|
|
storageViewModel.selectedPath
|
|
|
|
|
}
|
|
|
|
|
></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tile flex-no">
|
|
|
|
|
<div>
|
2026-04-09 16:48:22 +00:00
|
|
|
<b>{coreViewModel.translations.storage.content}</b>
|
2026-04-08 21:03:36 +00:00
|
|
|
<code
|
|
|
|
|
subscribe:innerText={
|
|
|
|
|
storageViewModel.selectedFileContent
|
|
|
|
|
}
|
|
|
|
|
></code>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{DangerousActionButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel,
|
|
|
|
|
coreViewModel.translations.storage.deleteItem,
|
2026-04-08 21:03:36 +00:00
|
|
|
"delete_forever",
|
|
|
|
|
storageViewModel.deleteSelectedItem,
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
return (
|
|
|
|
|
<div class="modal" toggle:open={storageViewModel.isShowingStorageModal}>
|
2026-04-08 21:14:37 +00:00
|
|
|
<div>
|
2026-04-08 21:03:36 +00:00
|
|
|
<main class="padding-0">
|
|
|
|
|
{SplitModal(
|
2026-04-10 19:00:59 +00:00
|
|
|
coreViewModel,
|
2026-04-08 21:03:36 +00:00
|
|
|
new React.State(DirectoryItemList(storageViewModel)),
|
|
|
|
|
detailView,
|
2026-04-08 21:14:37 +00:00
|
|
|
true,
|
2026-04-08 21:03:36 +00:00
|
|
|
)}
|
|
|
|
|
</main>
|
2026-04-14 17:19:35 +00:00
|
|
|
<button on:click={storageViewModel.close}>
|
2026-04-09 16:48:22 +00:00
|
|
|
{coreViewModel.translations.general.closeButton}
|
2026-04-01 08:29:39 +00:00
|
|
|
<span class="icon">close</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-07-21 17:55:53 +02:00
|
|
|
}
|