Skip to content

Commit

Permalink
fix: SonarQube issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-lab committed Feb 23, 2025
1 parent dd27a35 commit 7cdca48
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sonar.organization=yk-lab


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
sonar.sources=src/

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
17 changes: 11 additions & 6 deletions src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@
class="flex space-x-4 border rounded-md p-2 items-center justify-between select-none"
>
<div class="flex items-center space-x-4">
<GripVertical class="handle cursor-ns-resize" role="img" aria-label="Drag file" />
<img v-if="file.type === 'application/pdf'" :src="pdfIcon" class="size-8" />
<GripVertical class="handle cursor-ns-resize" aria-label="Drag to reorder" />
<img
v-if="file.type === 'application/pdf'"
:src="pdfIcon"
class="size-8"
alt="PDFアイコン"
aria-hidden="true"
/>
{{ file.name }}
<span class="text-sm">({{ filesize(file.size) }})</span>
</div>
<button @click="removeFile(id)" class="text-red-500 ml-4" aria-label="Remove file">
<Delete class="size-6" role="img" />
<span class="sr-only"> Remove</span>
<Delete class="size-6" />
<span class="sr-only">削除</span>
</button>
</li>
</ol>
Expand All @@ -26,8 +32,7 @@

<script lang="ts" setup>
import { useSortable } from '@vueuse/integrations/useSortable';
import { Delete } from 'lucide-vue-next';
import { GripVertical } from 'lucide-vue-next';
import { Delete, GripVertical } from 'lucide-vue-next';
import pdfIcon from '@/assets/icons/pdf.svg?url';
import { useTemplateRef, computed } from 'vue';
Expand Down
9 changes: 4 additions & 5 deletions src/components/MainArea.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<template>
<div>
<label
:for="inputFileId"
ref="dropZoneRef"
class="block border-dashed border-2 border-gray-400 px-4 py-8 rounded cursor-pointer"
:class="{ 'border-cyan-600': isOverDropZone }"
role="button"
tabindex="0"
aria-label="PDFファイルをアップロード"
@keypress.enter="$refs.fileInput.click()"
>
<input
ref="fileInput"
type="file"
:id="inputFileId"
class="hidden"
multiple
@change="handleFiles"
accept=".pdf"
aria-hidden="true"
/>
<div class="text-cyan-600">
<Upload class="size-8 mx-auto" aria-hidden="true" />
Expand Down Expand Up @@ -61,7 +59,7 @@
import * as pdfjsLib from 'pdfjs-dist';
import filesize from 'filesize.js';
import { Upload } from 'lucide-vue-next';
import { computed, ref, watch, onUnmounted } from 'vue';
import { useId, computed, ref, watch, onUnmounted } from 'vue';
import workerUrl from 'pdfjs-dist/build/pdf.worker.mjs?url';
import { getGeneratedPDFOutputFileName } from '@/utils/file';
import { mergePdfFiles, renderPdfToCanvases, createCompressedPdfFromImages } from '@/utils/pdf';
Expand All @@ -70,6 +68,7 @@ import { useDropZone } from '@vueuse/core';
pdfjsLib.GlobalWorkerOptions.workerSrc = workerUrl;
const inputFileId = useId();
const dropZoneRef = ref<HTMLDivElement>();
const pdfFiles = ref<{ id: string; file: File }[]>([]); // 選択されたPDFファイル
const compressedPDF = ref<string | null>(null); // 圧縮後のPDF Blob URL
Expand Down

0 comments on commit 7cdca48

Please sign in to comment.