diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 40dcdbd..9f9cbf5 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -19,6 +19,7 @@
"react-hotkeys": "^2.0.0",
"react-jss": "^10.9.2",
"react-router-dom": "^6.3.0",
+ "screenfull": "^6.0.2",
"swr": "^1.3.0",
"use-debounce": "^8.0.4"
},
@@ -1725,6 +1726,17 @@
"loose-envify": "^1.1.0"
}
},
+ "node_modules/screenfull": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-6.0.2.tgz",
+ "integrity": "sha512-AQdy8s4WhNvUZ6P8F6PB21tSPIYKniic+Ogx0AacBMjKP1GUHN2E9URxQHtCusiwxudnCKkdy4GrHXPPJSkCCw==",
+ "engines": {
+ "node": "^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -3086,6 +3098,11 @@
"loose-envify": "^1.1.0"
}
},
+ "screenfull": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-6.0.2.tgz",
+ "integrity": "sha512-AQdy8s4WhNvUZ6P8F6PB21tSPIYKniic+Ogx0AacBMjKP1GUHN2E9URxQHtCusiwxudnCKkdy4GrHXPPJSkCCw=="
+ },
"semver": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index a9dd199..710e35b 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -12,6 +12,7 @@
"react-hotkeys": "^2.0.0",
"react-jss": "^10.9.2",
"react-router-dom": "^6.3.0",
+ "screenfull": "^6.0.2",
"swr": "^1.3.0",
"use-debounce": "^8.0.4"
},
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index eca2071..78e507e 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -8,7 +8,6 @@ import { SOURCES_API, TRANSLATION_SOURCES_API } from './lib/consts'
import { TranslationSourcesContext } from './lib/contexts'
import { getLastOpened, getPosition } from './lib/utils'
import NotFound from './screens/404'
-import About from './screens/About'
import LineView from './screens/LineView'
import SourceView from './screens/SourceView'
import { SourcesResponse, TranslationSourcesResponse } from './types/api'
@@ -45,8 +44,6 @@ const App = () => {
} />
- } />
-
}
diff --git a/frontend/src/components/Nav.tsx b/frontend/src/components/Nav.tsx
index b8d4bfc..bc45b64 100644
--- a/frontend/src/components/Nav.tsx
+++ b/frontend/src/components/Nav.tsx
@@ -83,7 +83,7 @@ const Nav = () => {
-
+
diff --git a/frontend/src/components/Row.tsx b/frontend/src/components/Row.tsx
index 95f077d..82bb176 100644
--- a/frontend/src/components/Row.tsx
+++ b/frontend/src/components/Row.tsx
@@ -1,7 +1,5 @@
-import { ChevronRight } from 'lucide-react'
import { ReactNode } from 'react'
import { createUseStyles } from 'react-jss'
-import { Link } from 'react-router-dom'
import theme from '../helpers/theme'
@@ -21,10 +19,9 @@ const useStyles = createUseStyles( {
'& + $row': {
borderTop: [ '1px', 'solid', theme.Separator ],
},
- '& > div': {
+ '& > *': {
display: 'flex',
alignItems: 'center',
-
},
},
disabled: {
@@ -48,23 +45,21 @@ const useStyles = createUseStyles( {
} )
type RowProps = {
- to?: string,
- children: ReactNode,
- onClick?: React.MouseEventHandler,
disabled?: boolean,
+ onClick?: React.MouseEventHandler,
+ children: ReactNode,
}
-const Row = ( { to, disabled, onClick, children }: RowProps ) => {
+const Row = ( { disabled, onClick, children }: RowProps ) => {
const classes = useStyles()
return (
- null )}
>
- {children}
- {to &&
}
-
+ {children}
+
)
}
diff --git a/frontend/src/components/Separator.tsx b/frontend/src/components/Separator.tsx
new file mode 100644
index 0000000..521fee1
--- /dev/null
+++ b/frontend/src/components/Separator.tsx
@@ -0,0 +1,34 @@
+import { createUseStyles } from 'react-jss'
+
+import theme from '../helpers/theme'
+
+type SeparatorProps = {
+ height?: string,
+ margin?: string,
+}
+
+const useStyles = createUseStyles( {
+ separator: {
+ width: '100%',
+ height: '1px',
+ margin: `${theme.Gap} 0 0`,
+ padding: 0,
+ backgroundColor: `${theme.Separator}`,
+ },
+
+ '@media (prefers-color-scheme: dark)': {
+ separator: {
+ backgroundColor: `${theme.SeparatorDarkScheme}`,
+ },
+ },
+
+} )
+
+const Separator = ( { height, margin }: SeparatorProps ) => {
+ const classes = useStyles()
+ return (
+
+ )
+}
+
+export default Separator
diff --git a/frontend/src/screens/Collections.tsx b/frontend/src/screens/Collections.tsx
index ade51cb..b3469f7 100644
--- a/frontend/src/screens/Collections.tsx
+++ b/frontend/src/screens/Collections.tsx
@@ -1,4 +1,6 @@
+import { ChevronRight } from 'lucide-react'
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
+import { useNavigate } from 'react-router-dom'
import AsciiGurmukhi from '../components/AsciiGurmukhi'
import Content from '../components/Content'
@@ -23,6 +25,13 @@ const Collections = ( { setVisibleCollections }: CollectionsProps ) => {
const orderId = { 1: 0, 2: 1, 11: 3, 3: 4, 4: 5, 7: 6, 6: 7, 5: 8, 8: 9, 9: 10, 10: 11 }
+ const navigate = useNavigate()
+
+ const handleOnClick = ( link: string ) => {
+ navigate( link )
+ setVisibleCollections( false )
+ }
+
return (
@@ -33,10 +42,10 @@ const Collections = ( { setVisibleCollections }: CollectionsProps ) => {
.map( ( { id, nameGurmukhi } ) => (
setVisibleCollections( false )}
+ onClick={() => handleOnClick( `/sources/${id}/page/1/line/0` )}
>
{nameGurmukhi}
+
) )}
diff --git a/frontend/src/screens/Interface.tsx b/frontend/src/screens/Interface.tsx
index a94157b..7c9f445 100644
--- a/frontend/src/screens/Interface.tsx
+++ b/frontend/src/screens/Interface.tsx
@@ -1,19 +1,44 @@
-import { useAtom } from 'jotai'
+import { atom, useAtom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'
+import screenfull from 'screenfull'
import Content from '../components/Content'
+import Row from '../components/Row'
import Section from '../components/Section'
+import Separator from '../components/Separator'
import Slider from '../components/Slider'
export const zoom = atomWithStorage( 'zoom', 1 )
+export const fullscreen = atom( false )
const Interface = () => {
const [ valueZoom, setValueZoom ] = useAtom( zoom )
+ const [ valueFullscreen, setValueFullscreen ] = useAtom( fullscreen )
+
+ if ( screenfull.isEnabled ) {
+ screenfull.on( 'change', () => {
+ setValueFullscreen( !!screenfull.isFullscreen )
+ } )
+ }
+
+ const toggleFullScreen = () => {
+ if ( screenfull.isEnabled ) {
+ screenfull.toggle().catch( ( err: Error ) => console.error( 'Error fetching Sources', err ) )
+ }
+ }
+
return (
)