Skip to content

Commit

Permalink
Fixes for the file page overrunning
Browse files Browse the repository at this point in the history
  • Loading branch information
bp-cos committed Feb 6, 2024
1 parent af8fce5 commit 4c8746c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 30 deletions.
32 changes: 23 additions & 9 deletions app/guid-file/-components/file-detail-layout/styles.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
// stylelint-disable max-nesting-depth, selector-max-compound-selectors

.container {
display: flex;
flex-direction: row;
flex-grow: 1;
}

.main-column {
flex-grow: 3;
z-index: 1;
width: 70%;

&.mobile {
width: 100%;
}

&.is-closed {
flex: 1;
width: calc(100% - 72px);
}

h3 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 70vw;
width: 70%;
}
}

Expand All @@ -22,25 +33,28 @@
flex-basis: 300px;
flex-direction: column;
flex-grow: 1;
width: 28vw;
width: calc(30% - 72px);
min-width: 400px;

&.is-closed {
display: none;
}
}

.right-buttons {
@media (max-width: 767px) {
display: flex;
flex-direction: row;
justify-content: space-evenly;
border-top: 1px solid #ddd;
}
flex-grow: 0;
display: flex;
flex-direction: column;
border-left: 1px solid #ddd;
z-index: 1;
width: 72px;
min-width: 72px;

&.mobile {
flex-direction: row;
width: 100%;
margin-bottom: 10px;
}
}

.slide-in {
Expand Down
7 changes: 4 additions & 3 deletions app/guid-file/-components/file-detail-layout/template.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div local-class='container'>
{{#if @isMobile}}
<div local-class='main-column'>
<div local-class='main-column mobile'>
{{yield to='header'}}
<div local-class='right-buttons'>
<div local-class='right-buttons mobile'>
{{yield to='rightButtons'}}
</div>
<div>
Expand All @@ -14,7 +14,8 @@
</div>
</div>
{{else}}
<div local-class='main-column'>

<div local-class='main-column {{if @rightColumnClosed 'is-closed'}}'>
{{yield to='header'}}
{{yield to='body'}}
</div>
Expand Down
2 changes: 2 additions & 0 deletions app/guid-file/-components/file-header/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@


&.mobile {
padding: 0;

.flex-container-row {
padding: 0;
flex-direction: column;
Expand Down
11 changes: 2 additions & 9 deletions app/guid-file/index/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
min-width: 330px;

&.mobile {
margin-bottom: 10px;
margin-top: 0;
margin-left: 10px;
margin-right: 10px;
Expand All @@ -51,17 +52,9 @@
background-color: $color-bg-white;
border: 1px transparent;
color: $color-link-dark;
margin: 20px 20px 0;

@media (max-width: 767px) {
margin: 0;
}
margin: 0;

&.active {
@media (max-width: 767px) {
background-color: $color-bg-white;
color: $color-bg-black;
}
background-color: $color-bg-gray-light;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface TabArgs {
target: NodeModel;
cedarMetadataRecords: CedarMetadataRecordModel[];
defaultIndex: number;
displayFileMetadata: boolean;
}

export default class MetadataTabs extends Component<TabArgs> {
Expand All @@ -30,13 +31,15 @@ export default class MetadataTabs extends Component<TabArgs> {
}

private replaceHistory(): void {
if (this.activeId < 1) {
window.history.replaceState( {} , '',
`/${this.target.id}/metadata` );
} else {
const cedarMetadataRecord = this.cedarMetadataRecords[this.activeId - 1];
window.history.replaceState( {} , '',
`/${this.target.id}/metadata/${cedarMetadataRecord.id}` );
if (!this.args.displayFileMetadata) {
if (this.activeId < 1) {
window.history.replaceState( {} , '',
`/${this.target.id}/metadata` );
} else {
const cedarMetadataRecord = this.cedarMetadataRecords[this.activeId - 1];
window.history.replaceState( {} , '',
`/${this.target.id}/metadata/${cedarMetadataRecord.id}` );
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions mirage/scenarios/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function create3CedarMetadataFile(server: Server, currentUser: ModelInstance<Use

const filesNode = server.create('node', {
id: 'read-only',
title: 'Read-only user and non-admin',
title: 'Read-only user and non-admin and a super long name to see if there is overflow into the right nav area',
boaEnabled: true,
currentUserPermissions: [Permission.Read],
}, 'withFiles', 'withStorage', 'withContributors', 'withAffiliatedInstitutions', 'withDoi', 'withLinkedByNodes');
Expand All @@ -113,7 +113,8 @@ function create3CedarMetadataFile(server: Server, currentUser: ModelInstance<Use

const cedarFileNode = server.create('file', {
id: '3-cedar-metadata-file',
name: 'cedar metadata file',
// eslint-disable-next-line max-len
name: 'Cedar Metadata File on a read-only user and non-admin with a super long name to see if there is overflow in the right nav area',
checkout: currentUser.id,
target: filesNode,
parentFolder: filesNodeOsfStorage.rootFolder,
Expand Down

0 comments on commit 4c8746c

Please sign in to comment.