mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 21:24:05 +02:00
refactor: remove commented-out code and unused functions in index.vue for cleaner structure
This commit is contained in:
parent
96e5505b4d
commit
ff6cdac1a3
1 changed files with 0 additions and 88 deletions
|
@ -68,47 +68,6 @@
|
||||||
</div>
|
</div>
|
||||||
<BottomBar />
|
<BottomBar />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- <div class="right-panel">
|
|
||||||
<div
|
|
||||||
class="content"
|
|
||||||
v-if="selectedItem?.content_type === ContentType.Image">
|
|
||||||
<img :src="imageUrls[selectedItem.id]" alt="Image" class="image" />
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-else-if="selectedItem && isYoutubeWatchUrl(selectedItem.content)"
|
|
||||||
class="content">
|
|
||||||
<img
|
|
||||||
class="image"
|
|
||||||
:src="getYoutubeThumbnail(selectedItem.content)"
|
|
||||||
alt="YouTube Thumbnail" />
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="content"
|
|
||||||
v-else-if="
|
|
||||||
selectedItem?.content_type === ContentType.Link && pageOgImage
|
|
||||||
">
|
|
||||||
<img :src="pageOgImage" alt="Image" class="image" />
|
|
||||||
</div>
|
|
||||||
<OverlayScrollbarsComponent v-else class="content">
|
|
||||||
<span>{{ selectedItem?.content || "" }}</span>
|
|
||||||
</OverlayScrollbarsComponent>
|
|
||||||
|
|
||||||
<OverlayScrollbarsComponent
|
|
||||||
class="information"
|
|
||||||
:options="{ scrollbars: { autoHide: 'scroll' } }">
|
|
||||||
<div class="title">Information</div>
|
|
||||||
<div class="info-content" v-if="selectedItem && getInfo">
|
|
||||||
<div class="info-row" v-for="(row, index) in infoRows" :key="index">
|
|
||||||
<p class="label">{{ row.label }}</p>
|
|
||||||
<span :class="{ 'url-truncate': row.isUrl }" :data-text="row.value">
|
|
||||||
{{ row.value }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</OverlayScrollbarsComponent>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -395,19 +354,6 @@ const pasteSelectedItem = async (): Promise<void> => {
|
||||||
await $history.writeAndPaste({ content, contentType });
|
await $history.writeAndPaste({ content, contentType });
|
||||||
};
|
};
|
||||||
|
|
||||||
const truncateContent = (content: string): string => {
|
|
||||||
const maxWidth = 284;
|
|
||||||
const charWidth = 9;
|
|
||||||
const maxChars = Math.floor(maxWidth / charWidth);
|
|
||||||
return content.length > maxChars
|
|
||||||
? content.slice(0, maxChars - 3) + "..."
|
|
||||||
: content;
|
|
||||||
};
|
|
||||||
|
|
||||||
const hasFavicon = (str: string): boolean => {
|
|
||||||
return str.trim() !== "";
|
|
||||||
};
|
|
||||||
|
|
||||||
const isYoutubeWatchUrl = (url: string): boolean => {
|
const isYoutubeWatchUrl = (url: string): boolean => {
|
||||||
return (
|
return (
|
||||||
/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/watch\?v=[\w-]+/.test(
|
/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/watch\?v=[\w-]+/.test(
|
||||||
|
@ -428,10 +374,6 @@ const getYoutubeThumbnail = (url: string): string => {
|
||||||
: "https://via.placeholder.com/1280x720";
|
: "https://via.placeholder.com/1280x720";
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFaviconFromDb = (favicon: string): string => {
|
|
||||||
return `data:image/png;base64,${favicon}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateHistory = async (resetScroll: boolean = false): Promise<void> => {
|
const updateHistory = async (resetScroll: boolean = false): Promise<void> => {
|
||||||
const results = await $history.loadHistoryChunk(0, CHUNK_SIZE);
|
const results = await $history.loadHistoryChunk(0, CHUNK_SIZE);
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
|
@ -540,36 +482,6 @@ const setupEventListeners = async (): Promise<void> => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
focusSearchInput();
|
focusSearchInput();
|
||||||
|
|
||||||
keyboard.clear();
|
|
||||||
keyboard.prevent.down([Key.DownArrow], () => {
|
|
||||||
selectNext();
|
|
||||||
});
|
|
||||||
|
|
||||||
keyboard.prevent.down([Key.UpArrow], () => {
|
|
||||||
selectPrevious();
|
|
||||||
});
|
|
||||||
|
|
||||||
keyboard.prevent.down([Key.Enter], () => {
|
|
||||||
pasteSelectedItem();
|
|
||||||
});
|
|
||||||
|
|
||||||
keyboard.prevent.down([Key.Escape], () => {
|
|
||||||
hideApp();
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (os.value) {
|
|
||||||
case "macos":
|
|
||||||
keyboard.prevent.down([Key.LeftMeta, Key.K], () => {});
|
|
||||||
keyboard.prevent.down([Key.RightMeta, Key.K], () => {});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "linux":
|
|
||||||
case "windows":
|
|
||||||
keyboard.prevent.down([Key.LeftControl, Key.K], () => {});
|
|
||||||
keyboard.prevent.down([Key.RightControl, Key.K], () => {});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await listen("tauri://blur", () => {
|
await listen("tauri://blur", () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue