Skip to content

Commit 02026f8

Browse files
committed
bugfix
1 parent 126ae6d commit 02026f8

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

components/BulkContainer.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ const BulkContainer: React.FunctionComponent<BulkProps> = (props: BulkProps) =>
1111
const jsxArray = []
1212
const height = 1000 / props.files.length > 100 ? 1000 / props.files.length : 100
1313
for (let i = 0; i < props.files.length; i++) {
14-
// @ts-ignore
15-
jsxArray.push(<img className="bulk-img" src={props.files[i]} style={{"max-height": `${height}px`, width: "auto"}}/>)
14+
jsxArray.push(<img className="bulk-img" src={props.files[i]} style={{maxHeight: `${height}px`, width: "auto"}}/>)
1615
}
1716
return jsxArray
1817
}

components/PhotoViewer.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const PhotoViewer: React.FunctionComponent = (props) => {
9494
useEffect(() => {
9595
const getOpenedFile = async () => {
9696
const file = await ipcRenderer.invoke("get-opened-file")
97-
if (file && imageExtensions.includes(path.extname(file))) {
97+
if (file && imageExtensions.includes(path.extname(file).toLowerCase())) {
9898
upload (file)
9999
}
100100
}
@@ -425,14 +425,14 @@ const PhotoViewer: React.FunctionComponent = (props) => {
425425
if (typeof files === "string") files = [files]
426426
if (!files) files = await ipcRenderer.invoke("select-file") as string[]
427427
if (!files) return
428-
files = files.filter((f) => imageExtensions.includes(path.extname(f)))
428+
files = files.filter((f) => imageExtensions.includes(path.extname(f).toLowerCase()))
429429
if (files.length > 1) {
430430
setBulkFiles(files)
431431
setBulk(true)
432432
return ipcRenderer.invoke("update-original-images", files)
433433
}
434434
const file = files[0]
435-
if (!imageExtensions.includes(path.extname(file))) return
435+
if (!imageExtensions.includes(path.extname(file).toLowerCase())) return
436436
let newImg = file
437437
if (path.extname(file) === ".tiff") {
438438
newImg = await ipcRenderer.invoke("tiff-to-png", file)
@@ -650,7 +650,7 @@ const PhotoViewer: React.FunctionComponent = (props) => {
650650
const directory = await ipcRenderer.invoke("select-directory")
651651
if (!directory) return
652652
let files = fs.readdirSync(directory)
653-
files = files.filter((f) => imageExtensions.includes(path.extname(f))).map((f) => `${path.dirname(directory)}/${f}`)
653+
files = files.filter((f) => imageExtensions.includes(path.extname(f).toLowerCase())).map((f) => `${path.dirname(directory)}/${f}`)
654654
if (!files.length) return
655655
setBulkFiles(files)
656656
setBulk(true)

components/TitleBar.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ const TitleBar: React.FunctionComponent = (props) => {
8080
useEffect(() => {
8181
ipcRenderer.invoke("check-for-updates", true)
8282
const initTheme = async () => {
83-
const savedTheme = await ipcRenderer.invoke("get-theme")
84-
changeTheme(savedTheme)
8583
const savedTransparency = await ipcRenderer.invoke("get-transparency")
86-
changeTransparency(String(savedTransparency) === "true")
84+
const transparentValue = String(savedTransparency) === "true"
85+
changeTransparency(transparentValue)
86+
const savedTheme = await ipcRenderer.invoke("get-theme")
87+
changeTheme(savedTheme, transparentValue)
8788
}
8889
initTheme()
8990
const triggerAcceptAction = (event: any, action: string) => {
@@ -152,14 +153,15 @@ const TitleBar: React.FunctionComponent = (props) => {
152153
ipcRenderer.invoke("trigger-paste")
153154
}
154155

155-
const changeTheme = (value?: string) => {
156+
const changeTheme = (value?: string, transparentValue?: boolean) => {
156157
let condition = value !== undefined ? value === "dark" : theme === "light"
158+
let transVal = transparentValue !== undefined ? transparentValue : transparency
157159
if (condition) {
158-
functions.updateTheme("dark", transparency)
160+
functions.updateTheme("dark", transVal)
159161
setTheme("dark")
160162
ipcRenderer.invoke("save-theme", "dark")
161163
} else {
162-
functions.updateTheme("light", transparency)
164+
functions.updateTheme("light", transVal)
163165
setTheme("light")
164166
ipcRenderer.invoke("save-theme", "light")
165167
}

structures/functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default class Functions {
124124
public static getSortedFiles = async (dir: string) => {
125125
const files = await fs.promises.readdir(dir)
126126
return files
127-
.filter((f) => imageExtensions.includes(path.extname(f)))
127+
.filter((f) => imageExtensions.includes(path.extname(f).toLowerCase()))
128128
.map(fileName => ({
129129
name: fileName,
130130
time: fs.statSync(`${dir}/${fileName}`).mtime.getTime(),

0 commit comments

Comments
 (0)