Skip to content

Commit

Permalink
Merge pull request #685 from codeforpdx/Development
Browse files Browse the repository at this point in the history
Version Update from 1.0.0-alpha to 1.0.1-alpha
  • Loading branch information
leekahung authored Nov 14, 2024
2 parents 89e0a4f + 0e896f0 commit 3ee6a04
Show file tree
Hide file tree
Showing 30 changed files with 650 additions and 275 deletions.
90 changes: 54 additions & 36 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pass",
"homepage": ".",
"version": "1.0.0-alpha",
"version": "1.1.0-alpha",
"description": "",
"scripts": {
"start": "concurrently --kill-others \"npm run podserver\" \"npm run dev\"",
Expand Down
3 changes: 2 additions & 1 deletion src/AppRoutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useSession } from '@hooks';
import { CIVIC_FORM_LIST, FormLayout } from '@components/CivicProfileForms';
import { MESSAGE_PAGES_LIST, MessagesLayout } from '@components/Messages';
// Page Imports
import { CivicProfile, Home, Contacts, Profile, Signup } from './pages';
import { CivicProfile, Documents, Home, Contacts, Profile, Signup } from './pages';

const ProtectedRoute = ({ isLoggedIn, children }) =>
isLoggedIn ? children ?? <Outlet /> : <Navigate to="/" replace />;
Expand Down Expand Up @@ -58,6 +58,7 @@ const AppRoutes = () => {
))}
</Route>
<Route path="/profile" element={<Profile />} />
<Route path="/documents" element={<Documents />} />
{/* TODO: Remove blank Civic Profile page, ensure it directs Basic Information instead */}
<Route path="/civic-profile" element={<CivicProfile />}>
{CIVIC_FORM_LIST.map((formProps) => (
Expand Down
18 changes: 9 additions & 9 deletions src/components/Contacts/ContactListTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ import ContactListTableMobile from './ContactListTableMobile';
* @param {Function} Props.addContact - from Contacts page
* @returns {React.JSX.Element} The ContactListTable Component
*/
const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addContact }) => {
const ContactListTable = ({ contacts = [], deleteContact, handleDeleteContact, addContact }) => {
const [showMessageModal, setShowMessageModal] = useState(false);
const [messageToField, setMessageToField] = useState('');
const theme = useTheme();
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));

const [showAddContactModal, setShowAddContactModal] = useState(false);
const [contactToEdit, setContactToEdit] = useState({});
const [contactToEdit, setContactToEdit] = useState(null);
const [isEditing, setIsEditing] = useState(false);
const contactWebIds = contacts.map(({ webId }) => webId);
const theme = useTheme();
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));
const isSmallScreenHeight = useMediaQuery('(max-height: 600px)');

const handleSendMessage = (contactId) => {
setShowMessageModal(!showMessageModal);
Expand All @@ -47,17 +48,15 @@ const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addCon
setIsEditing(true);
};

const contactWebIds = contacts.map(({ webId }) => webId);

return (
<Box
sx={{
margin: '20px 0',
width: '95vw',
height: '500px'
minHeight: '500px'
}}
>
{isSmallScreen ? (
{isSmallScreen || isSmallScreenHeight ? (
<ContactListTableMobile
data-testid="ContactListTableMobile"
contacts={contacts}
Expand Down Expand Up @@ -89,6 +88,7 @@ const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addCon
handleDeleteContact={handleDeleteContact}
contactWebIds={contactWebIds}
contacts={contacts}
setContactToEdit={setContactToEdit}
/>
</Box>
);
Expand Down
1 change: 0 additions & 1 deletion src/components/Contacts/ContactListTableDesktop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const CustomToolbar = () => (
* @param {Function} Props.editContact - Function to edit a contact
* @param {Function} Props.handleSendMessage - Function to handle sending a message
* @param {string} Props.'data-testid' - Test ID
// * @param {Function} Props.handleProfileClick - Function to handle profile click
* @returns {React.JSX.Element} The ContactListTableDesktop component
*/
const ContactListTableDesktop = ({
Expand Down
40 changes: 24 additions & 16 deletions src/components/Documents/DocumentCard.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// React Imports
import React, { useState } from 'react';
import { useLocation } from 'react-router-dom';
// Material UI Imports
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
Expand Down Expand Up @@ -41,6 +42,9 @@ import { truncateText, getTypeText } from '@utils';
* @returns {React.JSX.Element} The DocumentCard component
*/
const DocumentCard = ({ document, onShare, onDelete, onPreview }) => {
const location = useLocation();
const profileWebId = decodeURIComponent(location.pathname.split('/')[2]);

const [anchorEl, setAnchorEl] = useState(null);
const [openMenu, setOpenMenu] = useState(null);

Expand Down Expand Up @@ -149,22 +153,26 @@ const DocumentCard = ({ document, onShare, onDelete, onPreview }) => {
>
Preview
</MenuItem>
<MenuItem
component={Button}
onClick={handleMenuItemClick(onShare, document)}
startIcon={<ShareIcon sx={iconSize} />}
sx={iconStyling}
>
Share
</MenuItem>
<MenuItem
component={Button}
onClick={handleMenuItemClick(onDelete, document)}
startIcon={<DeleteOutlineOutlinedIcon sx={iconSize} />}
sx={iconStyling}
>
Delete
</MenuItem>
{`${profileWebId}` === 'undefined' && (
<MenuItem
component={Button}
onClick={handleMenuItemClick(onShare, document)}
startIcon={<ShareIcon sx={iconSize} />}
sx={iconStyling}
>
Share
</MenuItem>
)}
{`${profileWebId}` === 'undefined' && (
<MenuItem
component={Button}
onClick={handleMenuItemClick(onDelete, document)}
startIcon={<DeleteOutlineOutlinedIcon sx={iconSize} />}
sx={iconStyling}
>
Delete
</MenuItem>
)}
</Menu>
</Card>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/components/Documents/DocumentTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const DocumentTable = ({ handleAclPermissionsModal, handleSelectDeleteDoc }) =>
const { documentListObject, loadingDocuments } = useContext(DocumentListContext);

const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
const isSmallScreenHeight = useMediaQuery('(max-height: 600px)');

/**
* Handles the local display of a document by opening it in a new window.
Expand Down Expand Up @@ -98,7 +99,7 @@ const DocumentTable = ({ handleAclPermissionsModal, handleSelectDeleteDoc }) =>
}}
data-testid="document-table"
>
{isMobile ? (
{isMobile || isSmallScreenHeight ? (
<DocumentsMobile documents={documents} handlers={handlers} data-testid="documents-mobile" />
) : (
<DocumentsDesktop
Expand Down
Loading

0 comments on commit 3ee6a04

Please sign in to comment.