Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/SelectedFolder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,24 @@
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
}

.folder-state:last-of-type {
flex: 1;
min-width: 0;
}

:global(.folder-icon) {
flex-shrink: 0;
}

.folder-name {
font-weight: 500;
color: var(--text-normal);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.clear-button {
Expand Down
47 changes: 20 additions & 27 deletions src/components/ShareFolderModalContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import type { Relay, RelayUser, Role } from "../Relay";
import type { RelayManager } from "../RelayManager";
import type { SharedFolder, SharedFolders } from "../SharedFolder";
import SettingItem from "./SettingItem.svelte";
import SettingItemHeading from "./SettingItemHeading.svelte";
import SettingGroup from "./SettingGroup.svelte";
import SlimSettingItem from "./SlimSettingItem.svelte";
import SelectedFolder from "./SelectedFolder.svelte";
import { onMount, onDestroy } from "svelte";
import { derived, writable } from "svelte/store";
Expand All @@ -22,6 +21,7 @@
isPrivate: boolean,
userIds: string[],
) => Promise<SharedFolder>;
export let setTitle: (title: string) => void = () => {};

let currentStep: "main" | "users" = "main";
let isPrivate = false;
Expand Down Expand Up @@ -109,6 +109,7 @@

if (isPrivate) {
currentStep = "users";
setTitle("Add Users to Folder");
} else {
handleShare();
}
Expand Down Expand Up @@ -154,6 +155,7 @@

function goBack() {
currentStep = "main";
setTitle("Share local folder");
}

function getInitials(name: string): string {
Expand Down Expand Up @@ -231,9 +233,7 @@
</script>

{#if currentStep === "main"}
<div class="modal-title">Share local folder</div>

<div class="modal-content share-folder-modal" bind:this={modalEl}>
<div class="share-folder-modal" bind:this={modalEl}>
<div class="section">
<SettingItemHeading name="Folder" />
<SelectedFolder
Expand All @@ -247,7 +247,7 @@
</div>

{#if relay.version > 0}
<SettingItem
<SlimSettingItem
name="Private"
description="Only selected users can access this folder"
>
Expand All @@ -263,23 +263,21 @@
<input type="checkbox" bind:checked={isPrivate} tabindex="-1" />
<div class="checkbox-toggle"></div>
</div>
</SettingItem>
</SlimSettingItem>
{/if}

<div class="modal-button-container">
<SlimSettingItem name="">
<button
class="mod-cta"
disabled={!acceptedFolder && !inputValue.trim()}
on:click={handleMainNext}
>
{isPrivate ? "Add Users" : "Share"}
</button>
</div>
</SlimSettingItem>
</div>
{:else if currentStep === "users"}
<div class="modal-title">Add Users to Folder</div>

<div class="modal-content share-folder-modal" bind:this={modalEl}>
<div class="share-folder-modal" bind:this={modalEl}>
<div class="section">
<SettingItemHeading name="Selected Folder" />
<SelectedFolder
Expand Down Expand Up @@ -363,20 +361,8 @@

<style>
.share-folder-modal {
min-width: 500px;
max-width: 600px;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
.share-folder-modal {
min-width: 100vw;
max-width: 100vw;
margin: 0;
border-radius: 0;
height: 100vh;
max-height: 100vh;
}
display: flex;
flex-direction: column;
}

.section {
Expand Down Expand Up @@ -480,9 +466,11 @@

.modal-button-container {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
margin-top: 24px;
margin-top: auto;
padding-top: 24px;
gap: 12px;
}

Expand All @@ -497,5 +485,10 @@

.checkbox-container {
cursor: pointer;
background-color: var(--background-modifier-border);
}

.checkbox-container.is-enabled {
background-color: var(--interactive-accent);
}
</style>
2 changes: 2 additions & 0 deletions src/ui/ShareFolderModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class ShareFolderModal extends Modal {

onOpen() {
const { contentEl } = this;
this.setTitle("Share local folder");

this.component = new ShareFolderModalContent({
target: contentEl,
Expand All @@ -32,6 +33,7 @@ export class ShareFolderModal extends Modal {
relay: this.relay,
relayManager: this.relayManager,
sharedFolders: this.sharedFolders,
setTitle: (title: string) => this.setTitle(title),
onConfirm: async (
folderPath: string,
folderName: string,
Expand Down