Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into experimental
- Loading branch information
Showing
11 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
core/prisma/migrations/20240428193209_bigint_media_size/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Warnings: | ||
- You are about to alter the column `size` on the `media` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`. | ||
*/ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_media" ( | ||
"id" TEXT NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL, | ||
"size" BIGINT NOT NULL, | ||
"extension" TEXT NOT NULL, | ||
"pages" INTEGER NOT NULL, | ||
"updated_at" DATETIME NOT NULL, | ||
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"modified_at" DATETIME, | ||
"hash" TEXT, | ||
"path" TEXT NOT NULL, | ||
"status" TEXT NOT NULL DEFAULT 'READY', | ||
"series_id" TEXT, | ||
CONSTRAINT "media_series_id_fkey" FOREIGN KEY ("series_id") REFERENCES "series" ("id") ON DELETE CASCADE ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_media" ("created_at", "extension", "hash", "id", "modified_at", "name", "pages", "path", "series_id", "size", "status", "updated_at") SELECT "created_at", "extension", "hash", "id", "modified_at", "name", "pages", "path", "series_id", "size", "status", "updated_at" FROM "media"; | ||
DROP TABLE "media"; | ||
ALTER TABLE "new_media" RENAME TO "media"; | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
/** | ||
* A hook to detect the zoom level of the browser. | ||
*/ | ||
export function useDetectZoom() { | ||
const [zoom, setZoom] = useState<number>() | ||
|
||
useEffect(() => { | ||
const handleResize = () => { | ||
setZoom(window.visualViewport?.scale) | ||
} | ||
|
||
window.visualViewport?.addEventListener('resize', handleResize) | ||
handleResize() | ||
return () => window.visualViewport?.removeEventListener('resize', handleResize) | ||
}, []) | ||
|
||
return { | ||
isZoomed: zoom !== undefined && zoom > 1, | ||
ratio: zoom, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters