Skip to content

Commit

Permalink
bug fixed escape closing panes added
Browse files Browse the repository at this point in the history
  • Loading branch information
mindiae committed Oct 4, 2024
1 parent f71abcf commit 76041b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/webview/booksHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Book struct {
func BooksHandler(module string) ([]Book, error) {
file := filepath.Join(APP_ROOT, "database", fmt.Sprintf("%s.SQLite3", module))
if !fileExists(file) {
file = filepath.Join(configPath, "database", fmt.Sprintf("%s.SQLite3", module))
file = filepath.Join(configPath, fmt.Sprintf("%s.SQLite3", module))
if !fileExists(file) {
return []Book{}, errors.New("file " + module + ".SQLite3" + " does not exist")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/webview/chapterHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Verse struct {
func ChapterHandler(module string, bookNumber int16, chapter int16) ([]string, error) {
file := filepath.Join(APP_ROOT, "database", fmt.Sprintf("%s.SQLite3", module))
if !fileExists(file) {
file = filepath.Join(configPath, "database", fmt.Sprintf("%s.SQLite3", module))
file = filepath.Join(configPath, fmt.Sprintf("%s.SQLite3", module))
if !fileExists(file) {
return []string{}, errors.New("file " + module + ".SQLite3" + " does not exist")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/webview/modulesHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type InfoRow struct {

func ModulesHandler() ([]map[string]string, error) {
internalDbDir := filepath.Join(APP_ROOT, "database")
configDbDir := filepath.Join(configPath, "database")
configDbDir := configPath

var emptyReturnValue []map[string]string
var modules []map[string]string
Expand Down Expand Up @@ -66,7 +66,7 @@ func ModulesHandler() ([]map[string]string, error) {
if err != nil {
return err
}
if !info.IsDir() {
if filepath.Ext(info.Name()) == ".SQLite3" {
moduleName := strings.TrimSuffix(info.Name(), filepath.Ext(info.Name()))
db, err := sql.Open("sqlite3", path)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions static/webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
>
<div
x-on:click.outside="booksopened = false"
x-on:keyup.escape.window="booksopened = false"
x-on:click="$dispatch('book-changed')"
class="grid gap-px bg-black max-w-full max-h-full grid-cols-6"
x-bind:style="`height: ${Math.ceil(bookstable.length/6) * 2}rem`"
Expand All @@ -248,6 +249,7 @@
>
<div
x-on:click.outside="books2opened = false"
x-on:keyup.escape.window="books2opened = false"
x-on:click="$dispatch('book-changed')"
class="bg-black grid grid-cols-6 max-w-full max-h-full gap-px"
x-bind:style="`height: ${Math.ceil(bookstable2.length/6) * 2}rem`"
Expand All @@ -271,6 +273,7 @@
>
<div
x-on:click.outside="chaptersopened = false"
x-on:keyup.escape.window="chaptersopened = false"
class="grid gap-px bg-black max-h-full max-w-full"
x-bind:style="`grid-template-columns: repeat(${chaptercolumns}, minmax(0, 1fr)); width: ${chaptercolumns*3}rem`"
>
Expand All @@ -293,6 +296,7 @@
>
<div
x-on:click.outside="modulesmenuopened = false"
x-on:keyup.escape.window="modulesmenuopened = false"
class="max-h-full max-w-full grid grid-cols-1 bg-black gap-px overflow-y-auto"
x-bind:style="`height: ${(modules.length +1 ) * 2}rem`"
>
Expand All @@ -318,6 +322,7 @@
>
<div
x-on:click.outside="modules2menuopened = false"
x-on:keyup.escape.window="modules2menuopened = false"
class="grid grid-cols-1 gap-px bg-black max-w-full max-h-full overflow-y-auto"
x-bind:style="`height: ${(modules.length +1) * 2}rem`"
>
Expand Down

0 comments on commit 76041b1

Please sign in to comment.