refactor: move node-share to app

pull/474/head
Varun Patil 2023-03-10 12:45:04 -08:00
parent 5a846cbde6
commit ec4ae09bf6
5 changed files with 23 additions and 24 deletions

View File

@ -46,7 +46,8 @@
<Settings :open.sync="settingsOpen" /> <Settings :open.sync="settingsOpen" />
<Sidebar /> <Sidebar />
<EditMetadata /> <EditMetadataModal />
<NodeShareModal />
</NcContent> </NcContent>
</template> </template>
@ -68,7 +69,8 @@ import Settings from "./components/Settings.vue";
import FirstStart from "./components/FirstStart.vue"; import FirstStart from "./components/FirstStart.vue";
import Metadata from "./components/Metadata.vue"; import Metadata from "./components/Metadata.vue";
import Sidebar from "./components/Sidebar.vue"; import Sidebar from "./components/Sidebar.vue";
import EditMetadata from "./components/modal/EditMetadataModal.vue"; import EditMetadataModal from "./components/modal/EditMetadataModal.vue";
import NodeShareModal from "./components/modal/NodeShareModal.vue";
import ImageMultiple from "vue-material-design-icons/ImageMultiple.vue"; import ImageMultiple from "vue-material-design-icons/ImageMultiple.vue";
import FolderIcon from "vue-material-design-icons/Folder.vue"; import FolderIcon from "vue-material-design-icons/Folder.vue";
@ -95,7 +97,8 @@ export default defineComponent({
Settings, Settings,
FirstStart, FirstStart,
Sidebar, Sidebar,
EditMetadata, EditMetadataModal,
NodeShareModal,
ImageMultiple, ImageMultiple,
FolderIcon, FolderIcon,

View File

@ -150,6 +150,7 @@ aside.app-sidebar {
// Prevent sidebar from becoming too big // Prevent sidebar from becoming too big
aside.app-sidebar { aside.app-sidebar {
max-width: 360px !important; max-width: 360px !important;
position: fixed !important;
@media (max-width: 512px) { @media (max-width: 512px) {
max-width: unset !important; max-width: unset !important;

View File

@ -91,7 +91,6 @@ import { API } from "../../services/API";
import CloseIcon from "vue-material-design-icons/Close.vue"; import CloseIcon from "vue-material-design-icons/Close.vue";
import LinkIcon from "vue-material-design-icons/LinkVariant.vue"; import LinkIcon from "vue-material-design-icons/LinkVariant.vue";
import { IPhoto } from "../../types";
type IShare = { type IShare = {
id: string; id: string;
@ -132,24 +131,13 @@ export default defineComponent({
}, },
created() { created() {
subscribe("update:share", this.refreshUrls); globalThis.shareNodeLink = (path: string) => {
}, this.filename = path;
this.open();
beforeDestroy() { };
unsubscribe("update:share", this.refreshUrls);
}, },
methods: { methods: {
openFolder() {
this.filename = utils.getFolderRoutePath(this.config_foldersPath);
this.open();
},
openPhoto(photo: IPhoto) {
this.filename = photo.filename;
this.open();
},
open() { open() {
this.show = true; this.show = true;
globalThis.mSidebar.setTab("sharing"); globalThis.mSidebar.setTab("sharing");

View File

@ -32,7 +32,7 @@
</NcActionRouter> </NcActionRouter>
<NcActionButton <NcActionButton
:aria-label="t('memories', 'Share folder')" :aria-label="t('memories', 'Share folder')"
@click="$refs.shareModal.openFolder()" @click="share()"
close-after-click close-after-click
> >
{{ t("memories", "Share folder") }} {{ t("memories", "Share folder") }}
@ -40,8 +40,6 @@
</NcActionButton> </NcActionButton>
</NcActions> </NcActions>
</div> </div>
<NodeShareModal ref="shareModal" />
</div> </div>
</template> </template>
@ -49,6 +47,7 @@
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { TopMatterFolder, TopMatterType } from "../../types"; import { TopMatterFolder, TopMatterType } from "../../types";
import UserConfig from "../../mixins/UserConfig";
const NcBreadcrumbs = () => const NcBreadcrumbs = () =>
import("@nextcloud/vue/dist/Components/NcBreadcrumbs"); import("@nextcloud/vue/dist/Components/NcBreadcrumbs");
const NcBreadcrumb = () => const NcBreadcrumb = () =>
@ -57,7 +56,7 @@ import NcActions from "@nextcloud/vue/dist/Components/NcActions";
import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton"; import NcActionButton from "@nextcloud/vue/dist/Components/NcActionButton";
import NcActionRouter from "@nextcloud/vue/dist/Components/NcActionRouter"; import NcActionRouter from "@nextcloud/vue/dist/Components/NcActionRouter";
import NodeShareModal from "../modal/NodeShareModal.vue"; import * as utils from "../../services/Utils";
import HomeIcon from "vue-material-design-icons/Home.vue"; import HomeIcon from "vue-material-design-icons/Home.vue";
import ShareIcon from "vue-material-design-icons/ShareVariant.vue"; import ShareIcon from "vue-material-design-icons/ShareVariant.vue";
@ -72,13 +71,14 @@ export default defineComponent({
NcActions, NcActions,
NcActionButton, NcActionButton,
NcActionRouter, NcActionRouter,
NodeShareModal,
HomeIcon, HomeIcon,
ShareIcon, ShareIcon,
TimelineIcon, TimelineIcon,
FoldersIcon, FoldersIcon,
}, },
mixins: [UserConfig],
data: () => ({ data: () => ({
topMatter: null as TopMatterFolder | null, topMatter: null as TopMatterFolder | null,
recursive: false, recursive: false,
@ -119,6 +119,12 @@ export default defineComponent({
this.recursive = false; this.recursive = false;
} }
}, },
share() {
globalThis.shareNodeLink(
utils.getFolderRoutePath(this.config_foldersPath)
);
},
}, },
}); });
</script> </script>

View File

@ -23,6 +23,7 @@ declare global {
var OCP: Nextcloud.v24.OCP; var OCP: Nextcloud.v24.OCP;
var editMetadata: (photos: IPhoto[], sections?: number[]) => void; var editMetadata: (photos: IPhoto[], sections?: number[]) => void;
var shareNodeLink: (path: string) => void;
var mSidebar: { var mSidebar: {
open: (filename: IFileInfo) => void; open: (filename: IFileInfo) => void;