Skip to content

Commit

Permalink
chore: code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AriTheElk committed Dec 27, 2024
1 parent 2462654 commit 7c9f0f6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 📷 Obsidian Image Picker
# 📷 Image Picker

Image Picker is a _blazingly_ fast way to browse and find media in your Obsidian vault. It's **extremely performant**, automatically generating thumbnails and background indexing your vault for instant search results.

Expand Down
2 changes: 1 addition & 1 deletion src/ImagePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ImagePicker extends Plugin {

this.addSettingTab(new ImagePickerSettingTab(this.app, this))

this.addRibbonIcon('image', 'Open Image Picker', async () => {
this.addRibbonIcon('image', 'Open image picker', async () => {
this.activateView()
})

Expand Down
12 changes: 6 additions & 6 deletions src/ImagePickerSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export class ImagePickerSettingTab extends PluginSettingTab {

// Input for selecting the image folder
new Setting(containerEl)
.setName('Image Folder')
.setName('Image folder')
.setDesc(
'Image picker will look for images in this folder and its subfolders, by default it will look in the root of the vault'
)
.addText((text) =>
text
.setPlaceholder('Image Folder')
.setPlaceholder('Image folder')
.setValue(this.plugin.settings.imageFolder)
.onChange(async (value) => {
this.plugin.settings.imageFolder = value || ''
Expand All @@ -39,12 +39,12 @@ export class ImagePickerSettingTab extends PluginSettingTab {

// Button for resetting the image index
new Setting(containerEl)
.setName('Reset Image Index')
.setName('Reset image index')
.setDesc(
'Clears the image index and rebuilds it from the image folder. Obsidian will reload immediately after. Please run this after changing the image folder.'
)
.addButton((button) =>
button.setButtonText('Reset Index').onClick(async () => {
button.setButtonText('Reset index').onClick(async () => {
this.plugin.images = []
// delete the database and rebuild it
await this.plugin.indexer.resetDB()
Expand All @@ -57,7 +57,7 @@ export class ImagePickerSettingTab extends PluginSettingTab {
// Toggle whether gifs are animated
new Setting(containerEl)
.setName('Animate GIFs')
.setDesc('Warning: large gifs can slow down or crash Obsidian')
.setDesc('Warning: large GIFs can slow down or crash Obsidian')
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.animateGifs)
Expand All @@ -69,7 +69,7 @@ export class ImagePickerSettingTab extends PluginSettingTab {

// Toggle whether to log debug messages
new Setting(containerEl)
.setName('Debug Mode')
.setName('Debug mode')
.setDesc('Log debug messages to the console')
.addToggle((toggle) =>
toggle
Expand Down
2 changes: 1 addition & 1 deletion src/ImagePickerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ImagePickerView extends ItemView {
}

getDisplayText() {
return 'Image Picker'
return 'Image picker'
}

getIcon(): string {
Expand Down
11 changes: 5 additions & 6 deletions src/client/ImagePickerView/ImagePickerView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { debounce, isEqual, throttle, truncate } from 'lodash'
import { useEffect, useState, useRef, useCallback, useMemo } from 'react'
import { Notice, TFile } from 'obsidian'
import { Notice, Platform, TFile } from 'obsidian'

import {
MOBILE_MAX_FILE_SIZE,
Expand All @@ -24,7 +24,6 @@ import { Pagination } from './Pagination'
import { Search } from './Search'

export const ImagePickerView = () => {
const IS_MOBILE = useRef(document.querySelector('.is-mobile') !== null)
const plugin = usePlugin()
const app = useApp()
const images = useFiles()
Expand Down Expand Up @@ -137,7 +136,7 @@ export const ImagePickerView = () => {

if (
getSizeInKb(file.stat.size) >
(IS_MOBILE.current ? MOBILE_MAX_FILE_SIZE : DESKTOP_MAX_FILE_SIZE)
(Platform.isMobile ? MOBILE_MAX_FILE_SIZE : DESKTOP_MAX_FILE_SIZE)
)
return false

Expand Down Expand Up @@ -293,9 +292,9 @@ export const ImagePickerView = () => {
length: 30,
})}
</option>
<option value="copy">Copy Image Embed</option>
<option value="path">Copy Image Path</option>
<option value="delete">Delete Image</option>
<option value="copy">Copy image embed</option>
<option value="path">Copy image path</option>
<option value="delete">Delete image</option>
</select>
<Thumbnail
key={file.path}
Expand Down

0 comments on commit 7c9f0f6

Please sign in to comment.