Skip to content

Commit

Permalink
REFACTORING: Mobile browsing should be kept out of the scope (see #142).
Browse files Browse the repository at this point in the history
As mobile browsing was developed, especially for self-guided tours, 
it appears that the mobile interface differed more and more from the
desktop one.
Keeping both in the same codebase made the resulting code too complex.
For this reason, the corresponding features (#94, #93 and #99) are now
removed from this application but could be put together in the future 
as a distinct frontend (with the same backend).
  • Loading branch information
benel committed Jan 7, 2024
1 parent e236a06 commit f094507
Show file tree
Hide file tree
Showing 26 changed files with 9 additions and 402 deletions.
28 changes: 0 additions & 28 deletions features/consult_collection.feature

This file was deleted.

11 changes: 0 additions & 11 deletions features/navigate_between_collections.feature

This file was deleted.

13 changes: 0 additions & 13 deletions features/navigate_inside_collection.feature

This file was deleted.

34 changes: 0 additions & 34 deletions features/step_definitions/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@
expect(find('.gloses'))
end

Soit('je ne vois pas les sources') do
expect(find('.sources', :visible => :hidden))
end

Soit('je ne vois pas les gloses') do
expect(find('.gloses', :visible => :hidden))
end

Soit('je suis sur téléphone') do
resize_window(550, 800)
end

Soit('je suis sur ordinateur') do
resize_window(1080, 1920)
end

Soit('une session active avec mon compte') do
sign_in('alice', 'whiterabbit')
end
Expand Down Expand Up @@ -78,24 +62,6 @@
sign_out
end

Soit("le texte {string} visible dans la navbar") do |text|
expect(find('.navbar-collec')).to have_content text
end

Soit("{string} le document actuel dans la collection") do |text|
expect(find('.runningHead')).to have_content text
end

Soit('le document actuel {string} dans la collection {string}') do |document, collection|
document_id = get_id(document)
collection_id = get_id(collection)
go_on_document_inside_collection(document_id, collection_id)
end

Soit('{string} autre collection dans laquelle le document principal est contenu') do |text|
expect(find('.related-collections-displayer')).to have_content text
end

Soit('{string} une des gloses ouverte') do |title|
click_on_icon_next_to('open', title)
end
6 changes: 1 addition & 5 deletions features/step_definitions/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
click_on_icon('create-collection')
end

Quand("je navigue vers le document suivant") do
click_on('->')
end

Quand("je clique sur la référence temporelle {string} avec pour commentaire {string}") do |timecode, comment|
find(:xpath, "//p[contains(., \"#{timecode}\")]", match: :first).click
end
end
4 changes: 0 additions & 4 deletions features/step_definitions/outcome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@
expect(find('.runningHead')).to have_content text
end

Alors("{string} est la collection actuelle") do |title|
expect(find('.current-collection')).to have_content title
end

Alors('la vidéo du document principal se lance de {string} secondes à {string} secondes') do |start, ending|
expect(page).to have_xpath("//iframe[contains(@src, 'start=#{start}&end=#{ending}')]")
end
16 changes: 0 additions & 16 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,10 @@ def leave_textarea
find('.navbar').click
end

def resize_window(width, heigth)
page.current_window.resize_to(width, heigth)
end

def go_on_document_inside_collection(document, collection)
visit "/collection/#{collection}/document/#{document}"
end

def get_id(name)
case name
when "Vitrail : Vie de Jean le Baptiste"
id = "ejrbzoefkznfkpz20"
when "Visite de l'Eglise St-Jean-au-Marché"
id = "ejrbzoefkznfkpzp"
else
id = "Not found"
end
return id
end

def fill_element(selector, text)
find(selector).fill_in with: text
end
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/BrowseTools.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Link } from 'react-router-dom';
import { Bookmark, ChevronBarDown, ChevronExpand } from 'react-bootstrap-icons';
import { isPhoneSizedWindow } from './utils';

function BrowseTools({id, closable, openable, collectionId}) {
function BrowseTools({id, closable, openable }) {
return (
<>
{closable &&
Expand All @@ -11,11 +10,11 @@ function BrowseTools({id, closable, openable, collectionId}) {
</Link>
}
{openable &&
<Link to={collectionId && isPhoneSizedWindow() ? `#/collection/${collectionId}/document/${id}` : `#${id}`} className="icon open">
<Link to={`#${id}`} className="icon open">
<ChevronExpand title="Open this document" />
</Link>
}
<Link to={collectionId && isPhoneSizedWindow() ? `../collection/${collectionId}/document/${id}` : `../${id}`} className="icon focus">
<Link to={`../${id}`} className="icon focus">
<Bookmark title="Focus on this document" />
</Link>
</>
Expand Down
19 changes: 2 additions & 17 deletions frontend/src/DocumentsCards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Link } from 'react-router-dom';
import { useMemo } from 'react';
import Card from 'react-bootstrap/Card';
import Col from 'react-bootstrap/Col';
import Row from 'react-bootstrap/Row';
Expand All @@ -8,7 +7,6 @@ import BrowseTools from './BrowseTools';
import FutureDocument from './FutureDocument';
import FutureCollection from './FutureCollection';
import { TypeBadge } from './Type';
import { isPhoneSizedWindow } from './utils';

function DocumentsCards({docs, expandable, byRow, createOn, setLastUpdate, backend}) {
return (
Expand Down Expand Up @@ -36,24 +34,11 @@ function DocumentsCards({docs, expandable, byRow, createOn, setLastUpdate, backe
);
}

export function DocumentCard({doc, expandable}) {
const collectionId = useMemo(() => {
if (doc?.links?.length > 1) {
return doc.links.every((item) => {
return item.verb === 'includes';
}) ? doc._id : undefined;
};
return undefined;
}, [doc]);

function DocumentCard({doc, expandable}) {
return (
<Card className="h-100">
<Card.Body>
<BrowseTools
id={collectionId ? doc.links.length && isPhoneSizedWindow() ? doc.links[0].object : doc._id : doc._id}
openable={expandable}
collectionId={collectionId}
/>
<BrowseTools id={doc._id} openable={expandable} />
<Metadata metadata={doc} />
<TypeBadge type={doc?.type}/>
</Card.Body>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useState } from 'react';

function Menu({backend}) {
return (
<Navbar bg="dark" variant="dark" className="navbarTop">
<Navbar bg="dark" variant="dark">
<Container>
<Navbar.Brand>
<Link to="/">
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/Page.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,3 @@ dd {
padding-left: 30px;
}

.navbar-collec {
display: none
}

@media screen and (max-width: 820px) {
.navbar-collec {
display: block
}
}
19 changes: 2 additions & 17 deletions frontend/src/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './Page.css';
import Container from 'react-bootstrap/Container';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import { useState, useEffect, useMemo } from 'react';
import { useState, useEffect } from 'react';
import { useParams, useLocation } from 'react-router-dom';
import { BookmarkFill } from 'react-bootstrap-icons';
import Metadata from './Metadata';
Expand All @@ -12,9 +12,6 @@ import BrowseTools from './BrowseTools';
import EditableText from './EditableText';
import DocumentSources from './DocumentSources';
import Type, { TypeBadge } from './Type';
import NavbarCollection from './navbarCollection';
import RelatedCollections from './RelatedCollections';
import { isPhoneSizedWindow } from './utils';

function Page({backend}) {

Expand All @@ -25,7 +22,7 @@ function Page({backend}) {
const [scholiaMetadata, setScholiaMetadata] = useState([]);
const [content, setContent] = useState([]);
const [lastUpdate, setLastUpdate] = useState();
let {id, collectionId} = useParams();
let {id} = useParams();
let margin = useLocation().hash.slice(1);
let hasRubrics = (id, rows) => rows.some(x => x.key[1] !== 0 && x.value.isPartOf === id && x.value.text);
const getCaption = ({dc_title, dc_spatial}) => dc_title + (dc_spatial ? `, ${dc_spatial}` : '');
Expand Down Expand Up @@ -131,18 +128,6 @@ function Page({backend}) {
createOn={[id]} {...{setLastUpdate, backend}}
/>
</Row>
<div className="navbar-collec">
{(collectionId) != undefined && metadata.length && id != undefined &&
<>
<RelatedCollections relatedDocumentsMetadata={scholiaMetadata}
currentCollectionId={collectionId} />
<NavbarCollection
trail={metadata.find((item) => item._id === collectionId)}
documentId={id}
/>
</>
}
</div>
</Container>
);
}
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/RelatedCollections.css

This file was deleted.

77 changes: 0 additions & 77 deletions frontend/src/RelatedCollections.js

This file was deleted.

8 changes: 0 additions & 8 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,3 @@ code {
margin: 12px 0;
}

@media screen and (max-width: 820px) {

.navbarTop,
.sources,
.gloses {
display: none !important;
}
}
1 change: 0 additions & 1 deletion frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ function App() {
<Routes>
<Route path="/" element={<Bookshelf {...{backend}} />} />
<Route path="/:id" element={<Page {...{backend}} />} />
<Route path="/collection/:collectionId/document/:id" element={<Page {...{backend}} />} />
</Routes>
</TypesContext.Provider>
</BrowserRouter>
Expand Down
Loading

0 comments on commit f094507

Please sign in to comment.