Merge pull request #2444 from omnivore-app/fix/web-highlight-tables
Web bug fixes
8
apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Jackson Harper on 6/29/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
BIN
apple/OmnivoreKit/Sources/Views/Images/Images.xcassets/BookOpen.imageset/BookOpen.png
vendored
Normal file
|
After Width: | Height: | Size: 482 B |
21
apple/OmnivoreKit/Sources/Views/Images/Images.xcassets/BookOpen.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "BookOpen.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
BIN
apple/OmnivoreKit/Sources/Views/Images/Images.xcassets/BookmarksSimple.imageset/BookmarksSimple.png
vendored
Normal file
|
After Width: | Height: | Size: 707 B |
21
apple/OmnivoreKit/Sources/Views/Images/Images.xcassets/BookmarksSimple.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "BookmarksSimple.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
21
apple/OmnivoreKit/Sources/Views/Images/Images.xcassets/HighlighterCircle.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "HighlighterCircle.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -1,12 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "home-tab.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.2495 18.7493V14.2492C14.2495 14.0503 14.1704 13.8595 14.0298 13.7189C13.8891 13.5782 13.6984 13.4992 13.4995 13.4992H10.4995C10.3005 13.4992 10.1098 13.5782 9.96912 13.7189C9.82847 13.8595 9.74945 14.0503 9.74945 14.2492V18.7493C9.74945 18.9482 9.67045 19.1389 9.52981 19.2796C9.38918 19.4202 9.19844 19.4992 8.99954 19.4993L4.50009 19.4999C4.40159 19.4999 4.30406 19.4805 4.21305 19.4428C4.12205 19.4051 4.03936 19.3499 3.9697 19.2802C3.90005 19.2106 3.8448 19.1279 3.8071 19.0369C3.7694 18.9459 3.75 18.8484 3.75 18.7499V10.0817C3.75 9.97721 3.77183 9.87388 3.8141 9.77832C3.85637 9.68276 3.91814 9.59709 3.99545 9.52679L11.4949 2.70791C11.633 2.58238 11.8129 2.51282 11.9995 2.51282C12.186 2.51281 12.3659 2.58236 12.504 2.70787L20.0045 9.52679C20.0818 9.59708 20.1436 9.68276 20.1859 9.77832C20.2282 9.87389 20.25 9.97724 20.25 10.0817V18.7499C20.25 18.8484 20.2306 18.9459 20.1929 19.0369C20.1552 19.1279 20.1 19.2106 20.0303 19.2802C19.9606 19.3499 19.878 19.4051 19.7869 19.4428C19.6959 19.4805 19.5984 19.4999 19.4999 19.4999L14.9994 19.4993C14.8005 19.4993 14.6097 19.4202 14.4691 19.2796C14.3285 19.1389 14.2494 18.9482 14.2495 18.7493V18.7493Z" stroke="#9D9B95" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1,12 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "home-tab-selected.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
<svg width="31" height="31" viewBox="0 0 31 31" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="15.1667" cy="15.5" r="15" fill="#F4DA7B"/>
|
||||
<path d="M17.4161 22.2493V17.7492C17.4161 17.5503 17.3371 17.3595 17.1965 17.2189C17.0558 17.0782 16.8651 16.9992 16.6661 16.9992H13.6661C13.4672 16.9992 13.2765 17.0782 13.1358 17.2189C12.9952 17.3595 12.9161 17.5503 12.9161 17.7492V22.2493C12.9161 22.4482 12.8371 22.6389 12.6965 22.7796C12.5559 22.9202 12.3651 22.9992 12.1662 22.9993L7.66678 22.9999C7.56828 22.9999 7.47074 22.9805 7.37974 22.9428C7.28873 22.9051 7.20604 22.8499 7.13639 22.7802C7.06674 22.7106 7.01148 22.6279 6.97379 22.5369C6.93609 22.4459 6.91669 22.3484 6.91669 22.2499V13.5817C6.91669 13.4772 6.93852 13.3739 6.98079 13.2783C7.02306 13.1828 7.08482 13.0971 7.16213 13.0268L14.6616 6.20791C14.7997 6.08238 14.9796 6.01282 15.1661 6.01282C15.3527 6.01281 15.5326 6.08236 15.6707 6.20787L23.1712 13.0268C23.2485 13.0971 23.3103 13.1828 23.3526 13.2783C23.3948 13.3739 23.4167 13.4772 23.4167 13.5817V22.2499C23.4167 22.3484 23.3973 22.4459 23.3596 22.5369C23.3219 22.6279 23.2666 22.7106 23.197 22.7802C23.1273 22.8499 23.0446 22.9051 22.9536 22.9428C22.8626 22.9805 22.7651 22.9999 22.6666 22.9999L18.166 22.9993C17.9671 22.9993 17.7764 22.9202 17.6358 22.7796C17.4951 22.6389 17.4161 22.4482 17.4161 22.2493V22.2493Z" stroke="#382D05" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "moon-stars.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32" version="1.1">
|
||||
<g id="surface1">
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 216 112 L 216 64 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 240 88 L 192 88 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 168 24 L 168 56 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 184 40 L 152 40 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 216.6875 152.59375 C 184.71875 161.5625 150.375 152.59375 126.90625 129.09375 C 103.40625 105.625 94.4375 71.28125 103.40625 39.3125 C 60.59375 51.21875 32.4375 92 36.4375 136.25 C 40.46875 180.5 75.5 215.53125 119.75 219.5625 C 164 223.5625 204.78125 195.40625 216.6875 152.59375 Z M 216.6875 152.59375 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "moon.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32" version="1.1">
|
||||
<g id="surface1">
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 216.6875 152.59375 C 184.71875 161.5625 150.375 152.59375 126.90625 129.09375 C 103.40625 105.625 94.4375 71.28125 103.40625 39.3125 C 60.59375 51.21875 32.4375 92 36.4375 136.25 C 40.46875 180.5 75.5 215.53125 119.75 219.5625 C 164 223.5625 204.78125 195.40625 216.6875 152.59375 Z M 216.6875 152.59375 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 705 B |
@ -1,15 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "mountains.svg",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32" version="1.1">
|
||||
<g id="surface1">
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 184 52 C 184 63.03125 175.03125 72 164 72 C 152.96875 72 144 63.03125 144 52 C 144 40.96875 152.96875 32 164 32 C 175.03125 32 184 40.96875 184 52 Z M 184 52 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 8 200 L 81.09375 75.6875 C 82.5625 73.3125 85.1875 71.84375 88 71.84375 C 90.8125 71.84375 93.4375 73.3125 94.90625 75.6875 L 168 200 Z M 8 200 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 50.40625 128 L 125.59375 128 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
<path style="fill:none;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 144.09375 159.40625 L 177.09375 103.59375 C 178.5625 101.1875 181.1875 99.75 184 99.75 C 186.8125 99.75 189.4375 101.1875 190.90625 103.59375 L 248 200 L 168 200 " transform="matrix(0.125,0,0,0.125,0,0)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@ -69,6 +69,11 @@ export function HighlightNoteModal(
|
||||
onPointerDownOutside={(event) => {
|
||||
event.preventDefault()
|
||||
}}
|
||||
onEscapeKeyDown={(event) => {
|
||||
props.onOpenChange(false)
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}}
|
||||
>
|
||||
<form
|
||||
onSubmit={(event) => {
|
||||
|
||||
@ -174,6 +174,9 @@ type FooterProps = {
|
||||
filterText: string
|
||||
selectedLabels: Label[]
|
||||
availableLabels: Label[]
|
||||
|
||||
createEnteredLabel: () => Promise<void>
|
||||
selectEnteredLabel: () => Promise<void>
|
||||
}
|
||||
|
||||
function Footer(props: FooterProps): JSX.Element {
|
||||
@ -233,7 +236,17 @@ function Footer(props: FooterProps): JSX.Element {
|
||||
<HStack
|
||||
alignment="center"
|
||||
distribution="start"
|
||||
css={{ gap: '8px', fontSize: '12px' }}
|
||||
css={{ gap: '8px', fontSize: '12px', pointer: 'cursor' }}
|
||||
onClick={async (event) => {
|
||||
switch (textMatch) {
|
||||
case 'available':
|
||||
await props.selectEnteredLabel()
|
||||
return
|
||||
case 'none':
|
||||
await props.createEnteredLabel()
|
||||
return
|
||||
}
|
||||
}}
|
||||
>
|
||||
{textMatch === 'available' && (
|
||||
<>
|
||||
@ -273,7 +286,6 @@ export function SetLabelsControl(props: SetLabelsControlProps): JSX.Element {
|
||||
const [focusedIndex, setFocusedIndex] = useState<number | undefined>(0)
|
||||
|
||||
useEffect(() => {
|
||||
console.log('setting focused index: ', inputValue)
|
||||
setFocusedIndex(undefined)
|
||||
}, [inputValue])
|
||||
|
||||
@ -398,6 +410,22 @@ export function SetLabelsControl(props: SetLabelsControlProps): JSX.Element {
|
||||
]
|
||||
)
|
||||
|
||||
const createEnteredLabel = useCallback(() => {
|
||||
const _filterText = inputValue
|
||||
setInputValue('')
|
||||
return createLabelFromFilterText(_filterText)
|
||||
}, [inputValue])
|
||||
|
||||
const selectEnteredLabel = useCallback(() => {
|
||||
const label = labels.find(
|
||||
(l: Label) => l.name.toLowerCase() == inputValue.toLowerCase()
|
||||
)
|
||||
if (!label) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
return toggleLabel(label)
|
||||
}, [labels, inputValue])
|
||||
|
||||
return (
|
||||
<VStack
|
||||
distribution="start"
|
||||
@ -475,6 +503,8 @@ export function SetLabelsControl(props: SetLabelsControlProps): JSX.Element {
|
||||
selectedLabels={props.selectedLabels}
|
||||
availableLabels={labels}
|
||||
focused={focusedIndex === filteredLabels.length + 1}
|
||||
createEnteredLabel={createEnteredLabel}
|
||||
selectEnteredLabel={selectEnteredLabel}
|
||||
/>
|
||||
)}
|
||||
</VStack>
|
||||
|
||||
@ -13,7 +13,7 @@ export type LabelsDispatcher = (action: {
|
||||
export const useSetPageLabels = (
|
||||
articleId?: string
|
||||
): [{ labels: Label[] }, LabelsDispatcher] => {
|
||||
const saveLabels = (labels: Label[]) => {
|
||||
const saveLabels = (labels: Label[], articleId: string) => {
|
||||
;(async () => {
|
||||
const labelIds = labels.map((l) => l.id)
|
||||
if (articleId) {
|
||||
@ -30,11 +30,13 @@ export const useSetPageLabels = (
|
||||
const labelsReducer = (
|
||||
state: {
|
||||
labels: Label[]
|
||||
throttledSave: (labels: Label[]) => void
|
||||
articleId: string | undefined
|
||||
throttledSave: (labels: Label[], articleId: string) => void
|
||||
},
|
||||
action: {
|
||||
type: string
|
||||
labels: Label[]
|
||||
articleId?: string
|
||||
}
|
||||
) => {
|
||||
switch (action.type) {
|
||||
@ -51,8 +53,8 @@ export const useSetPageLabels = (
|
||||
}
|
||||
}
|
||||
case 'SAVE': {
|
||||
if (articleId) {
|
||||
state.throttledSave(action.labels)
|
||||
if (state.articleId) {
|
||||
state.throttledSave(action.labels, state.articleId)
|
||||
} else {
|
||||
showErrorToast('Unable to update labels', {
|
||||
position: 'bottom-right',
|
||||
@ -63,17 +65,36 @@ export const useSetPageLabels = (
|
||||
labels: action.labels,
|
||||
}
|
||||
}
|
||||
case 'UPDATE_ARTICLE_ID': {
|
||||
return {
|
||||
...state,
|
||||
articleId: action.articleId,
|
||||
}
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
const debouncedSave = useCallback(
|
||||
throttle((labels: Label[]) => saveLabels(labels), 2000),
|
||||
throttle(
|
||||
(labels: Label[], articleId: string) => saveLabels(labels, articleId),
|
||||
2000
|
||||
),
|
||||
[]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
dispatchLabels({
|
||||
type: 'UPDATE_ARTICLE_ID',
|
||||
labels: [],
|
||||
articleId: articleId,
|
||||
})
|
||||
}, [articleId])
|
||||
|
||||
const [labels, dispatchLabels] = useReducer(labelsReducer, {
|
||||
labels: [],
|
||||
articleId: articleId,
|
||||
throttledSave: debouncedSave,
|
||||
})
|
||||
|
||||
|
||||
@ -368,7 +368,9 @@ export default function Home(): JSX.Element {
|
||||
[readerSettings, showHighlightsModal]
|
||||
)
|
||||
|
||||
const [labels, dispatchLabels] = useSetPageLabels(article?.id)
|
||||
const [labels, dispatchLabels] = useSetPageLabels(
|
||||
articleData?.article.article?.id
|
||||
)
|
||||
|
||||
if (articleFetchError && articleFetchError.indexOf('NOT_FOUND') > -1) {
|
||||
router.push('/404')
|
||||
|
||||