Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List books #606

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions public/compiled-lang/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,18 @@
"value": "Nossa História"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4105,6 +4105,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4125,6 +4125,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -4101,6 +4101,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -4117,6 +4117,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
12 changes: 12 additions & 0 deletions public/compiled-lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -4125,6 +4125,18 @@
"value": "Our Story"
}
],
"passageNavigation__selector-grid": [
{
"type": 0,
"value": "Grid"
}
],
"passageNavigation__selector-list": [
{
"type": 0,
"value": "List"
}
],
"personTypeLockup_type": [
{
"type": 0,
Expand Down
8 changes: 8 additions & 0 deletions public/lang/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "Histórico"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "Verlauf"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,14 @@
"ourStory__title": {
"string": "Our Story"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
},
"personTypeLockup_type": {
"string": "Presenter"
},
Expand Down
8 changes: 8 additions & 0 deletions public/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "Historial"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "Historique"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "履歴"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "История"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
8 changes: 8 additions & 0 deletions public/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2735,5 +2735,13 @@
},
"bibles__history": {
"string": "历史"
},
"passageNavigation__selector-grid": {
"comment": "Switch to grid view",
"string": "Grid"
},
"passageNavigation__selector-list": {
"comment": "Switch to list view",
"string": "List"
}
}
22 changes: 18 additions & 4 deletions src/components/organisms/passageNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import clsx from 'clsx';
import React, { useRef, useState } from 'react';
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';

import { useLocalStorage } from '~src/lib/hooks/useLocalStorage';

import { PassageNavigationFragment } from './__generated__/passageNavigation';
import BookGrid from './bookGrid';
Expand Down Expand Up @@ -57,7 +60,10 @@ export default function PassageNavigation({ books }: Props): JSX.Element {
const [selectedBook, setSelectedBook] = useState<string | number | null>(
null,
);
const [selectedView, setSelectedView] = useState<'grid' | 'list'>('grid');
const [selectedView, setSelectedView] = useLocalStorage<'grid' | 'list'>(
'passageNavLayout',
'grid',
);

return (
<div className={styles.wrapper}>
Expand All @@ -66,13 +72,21 @@ export default function PassageNavigation({ books }: Props): JSX.Element {
className={clsx({ active: selectedView === 'grid' })}
onClick={() => setSelectedView('grid')}
>
Grid
<FormattedMessage
id="passageNavigation__selector-grid"
defaultMessage="Grid"
description="Switch to grid view"
/>
</button>
<button
className={clsx({ active: selectedView === 'list' })}
onClick={() => setSelectedView('list')}
>
List
<FormattedMessage
id="passageNavigation__selector-list"
defaultMessage="List"
description="Switch to list view"
/>
</button>
</div>

Expand Down