Skip to content

Commit

Permalink
task/WG-232-React-Listing-UI-clean
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-massie committed Oct 3, 2024
1 parent 0fc9690 commit 82ac31a
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 43 deletions.
9 changes: 9 additions & 0 deletions react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0",
"@changey/react-leaflet-markercluster": "^4.0.0-rc1",
"@fortawesome/fontawesome-free": "^6.6.0",
"@reduxjs/toolkit": "^1.8.4",
"@tacc/core-styles": "^2.24.1",
"@testing-library/react": "^13.4.0",
Expand Down
46 changes: 46 additions & 0 deletions react/src/components/Projects/ProjectListing.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.root{
display: flex;
flex-direction: column;
width: 100%;
}
.projectList {
height: 270px;
border-collapse: collapse;
align-self: center;
overflow-y: scroll;
margin-top: 40px;
margin-bottom: 40px;
}
.projectHeader, .projectHeader th {
background: #d0d0d0;
position: sticky;
top: 0;
z-index: 1;
}

.projectListItemButton{
cursor: pointer;
color: initial;
margin-right: 10px;
}

.projectListItemButton:hover{
color: #666;
}

.mapColumn {
width: 30%;
}
.projectColumn {
width: 60%;
}
.buttonColumn {
white-space: nowrap;
}

.projectName {
max-width: fit-content;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
80 changes: 44 additions & 36 deletions react/src/components/Projects/ProjectListing.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useState } from 'react';
import { useProjectsWithDesignSafeInformation } from '../../hooks';
import { Button, LoadingSpinner, Icon } from '../../core-components';
import styles from './ProjectListing.module.css';
import CreateMapModal from '../CreateMapModal/CreateMapModal';
import { useNavigate } from 'react-router-dom';

export const ProjectListing: React.FC = () => {
const ProjectListing: React.FC = () => {
const [isModalOpen, setIsModalOpen] = useState(false);
const navigate = useNavigate();

Expand All @@ -20,47 +21,54 @@ export const ProjectListing: React.FC = () => {

if (isLoading) {
return <LoadingSpinner />;
}
};

Check failure on line 24 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Delete `;`

if (isError) {
return <h4>Unable to retrieve projects</h4>;
}
};

Check failure on line 28 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Delete `;`

return (
<>
<table>
<thead>
<tr>
<th>Map</th>
<th>Project</th>
<th>
<CreateMapModal isOpen={isModalOpen} toggle={toggleModal} />
<Button onClick={toggleModal} size="small">
Create a New Map
</Button>
</th>
</tr>
</thead>
<tbody>
{data?.map((proj) => (
<tr key={proj.id} onClick={() => navigateToProject(proj.uuid)}>
<td>{proj.name}</td>
<td>
{proj.ds_project?.value.projectId}{' '}
{proj.ds_project?.value.title}
</td>
<td>
<Button>
<Icon name="edit-document"></Icon>
</Button>
<Button>
<Icon name="trash"></Icon>
<div className={styles.root}>
<div className={styles.projectList}>
<table>
<thead className={styles.projectHeader}>
<tr>
<th className={styles.mapColumn}>Map</th>
<th className={styles.projectColumn}>Project</th>
<th className={styles.buttonColumn}>
<CreateMapModal isOpen={isModalOpen} toggle={toggleModal} />
<Button
onClick={toggleModal}
type="link"
className={styles.projectListItemButton}
>
<Icon name="add"/>Create a New Map

Check failure on line 45 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Replace `/>` with `·/>⏎··················`
</Button>
</td>
</th>
</tr>
))}
</tbody>
</table>
</>
</thead>
<tbody>
{data?.map((proj) => (
<tr key={proj.id} onClick={() => navigateToProject(proj.uuid)}>

Check failure on line 52 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Delete `·`
<td className={styles.projectName}>{proj.name}</td>
<td>
{proj.ds_project?.value.projectId}{' - '}

Check failure on line 55 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Insert `⏎··················`
{proj.ds_project?.value.title}
</td>
<td >

Check failure on line 58 in react/src/components/Projects/ProjectListing.tsx

View workflow job for this annotation

GitHub Actions / React-Linting

Delete `·`
<Button type="link" className={styles.projectListItemButton}>
<Icon name="edit-document"></Icon>
</Button>
<Button type="link" className={styles.projectListItemButton}>
<Icon name="trash"></Icon>
</Button>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
);
};
export default ProjectListing;
2 changes: 1 addition & 1 deletion react/src/components/Projects/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { ProjectListing } from './ProjectListing';
export { default } from './ProjectListing';
20 changes: 18 additions & 2 deletions react/src/hazmapper.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@import url('@tacc/core-styles/dist/core-styles.base.css');
@import url('@tacc/core-styles/dist/core-styles.portal.css');
@import "leaflet/dist/leaflet.css";
@import "@fortawesome/fontawesome-free/css/all.css";
@import url('https://fonts.googleapis.com/css?family=Raleway');
@import url('https://unpkg.com/[email protected]/dist/mapillary.min.css');

/* for hazmapper specific overwrites of base and portal styles" like,
Expand All @@ -8,3 +10,17 @@
}
*/


/* CSS module styles taken from Angular styles.styl */
:root {
--global-font-family: 'Raleway', san-serif;
}
html,
body {
height: 100%;
font-family: var(--global-font-family);
}
table, form, button {
font-family: inherit;
}
4 changes: 2 additions & 2 deletions react/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* prettier-ignore */
@import url('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css') layer(foundation);

@import url('@tacc/core-styles/dist/core-styles.base.css'); /* layer(base);*/
@import url('@tacc/core-styles/dist/core-styles.portal.css'); /* layer(base);*/
@import url('@tacc/core-styles/dist/core-styles.base.css') layer(base);
@import url('@tacc/core-styles/dist/core-styles.portal.css') layer(base);

@import url('./hazmapper.css') layer(project);
3 changes: 1 addition & 2 deletions react/src/pages/MainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import {
} from '../../core-components';
import useAuthenticatedUser from '../../hooks/user/useAuthenticatedUser';
import { SystemSelect } from '../../components/Systems';
import { ProjectListing } from '../../components/Projects/ProjectListing';

import ProjectListing from '../../components/Projects';
function MainMenu() {
const {
data: userData,
Expand Down

0 comments on commit 82ac31a

Please sign in to comment.