Skip to content

Commit 3ee6a04

Browse files
authored
Merge pull request #685 from codeforpdx/Development
Version Update from 1.0.0-alpha to 1.0.1-alpha
2 parents 89e0a4f + 0e896f0 commit 3ee6a04

30 files changed

+650
-275
lines changed

package-lock.json

Lines changed: 54 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pass",
33
"homepage": ".",
4-
"version": "1.0.0-alpha",
4+
"version": "1.1.0-alpha",
55
"description": "",
66
"scripts": {
77
"start": "concurrently --kill-others \"npm run podserver\" \"npm run dev\"",

src/AppRoutes.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useSession } from '@hooks';
77
import { CIVIC_FORM_LIST, FormLayout } from '@components/CivicProfileForms';
88
import { MESSAGE_PAGES_LIST, MessagesLayout } from '@components/Messages';
99
// Page Imports
10-
import { CivicProfile, Home, Contacts, Profile, Signup } from './pages';
10+
import { CivicProfile, Documents, Home, Contacts, Profile, Signup } from './pages';
1111

1212
const ProtectedRoute = ({ isLoggedIn, children }) =>
1313
isLoggedIn ? children ?? <Outlet /> : <Navigate to="/" replace />;
@@ -58,6 +58,7 @@ const AppRoutes = () => {
5858
))}
5959
</Route>
6060
<Route path="/profile" element={<Profile />} />
61+
<Route path="/documents" element={<Documents />} />
6162
{/* TODO: Remove blank Civic Profile page, ensure it directs Basic Information instead */}
6263
<Route path="/civic-profile" element={<CivicProfile />}>
6364
{CIVIC_FORM_LIST.map((formProps) => (

src/components/Contacts/ContactListTable.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ import ContactListTableMobile from './ContactListTableMobile';
2626
* @param {Function} Props.addContact - from Contacts page
2727
* @returns {React.JSX.Element} The ContactListTable Component
2828
*/
29-
const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addContact }) => {
29+
const ContactListTable = ({ contacts = [], deleteContact, handleDeleteContact, addContact }) => {
3030
const [showMessageModal, setShowMessageModal] = useState(false);
3131
const [messageToField, setMessageToField] = useState('');
32-
const theme = useTheme();
33-
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));
34-
3532
const [showAddContactModal, setShowAddContactModal] = useState(false);
36-
const [contactToEdit, setContactToEdit] = useState({});
33+
const [contactToEdit, setContactToEdit] = useState(null);
3734
const [isEditing, setIsEditing] = useState(false);
35+
const contactWebIds = contacts.map(({ webId }) => webId);
36+
const theme = useTheme();
37+
const isSmallScreen = useMediaQuery(theme.breakpoints.down('sm'));
38+
const isSmallScreenHeight = useMediaQuery('(max-height: 600px)');
3839

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

50-
const contactWebIds = contacts.map(({ webId }) => webId);
51-
5251
return (
5352
<Box
5453
sx={{
5554
margin: '20px 0',
5655
width: '95vw',
57-
height: '500px'
56+
minHeight: '500px'
5857
}}
5958
>
60-
{isSmallScreen ? (
59+
{isSmallScreen || isSmallScreenHeight ? (
6160
<ContactListTableMobile
6261
data-testid="ContactListTableMobile"
6362
contacts={contacts}
@@ -89,6 +88,7 @@ const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addCon
8988
handleDeleteContact={handleDeleteContact}
9089
contactWebIds={contactWebIds}
9190
contacts={contacts}
91+
setContactToEdit={setContactToEdit}
9292
/>
9393
</Box>
9494
);

src/components/Contacts/ContactListTableDesktop.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const CustomToolbar = () => (
4040
* @param {Function} Props.editContact - Function to edit a contact
4141
* @param {Function} Props.handleSendMessage - Function to handle sending a message
4242
* @param {string} Props.'data-testid' - Test ID
43-
// * @param {Function} Props.handleProfileClick - Function to handle profile click
4443
* @returns {React.JSX.Element} The ContactListTableDesktop component
4544
*/
4645
const ContactListTableDesktop = ({

src/components/Documents/DocumentCard.jsx

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// React Imports
22
import React, { useState } from 'react';
3+
import { useLocation } from 'react-router-dom';
34
// Material UI Imports
45
import Box from '@mui/material/Box';
56
import Button from '@mui/material/Button';
@@ -41,6 +42,9 @@ import { truncateText, getTypeText } from '@utils';
4142
* @returns {React.JSX.Element} The DocumentCard component
4243
*/
4344
const DocumentCard = ({ document, onShare, onDelete, onPreview }) => {
45+
const location = useLocation();
46+
const profileWebId = decodeURIComponent(location.pathname.split('/')[2]);
47+
4448
const [anchorEl, setAnchorEl] = useState(null);
4549
const [openMenu, setOpenMenu] = useState(null);
4650

@@ -149,22 +153,26 @@ const DocumentCard = ({ document, onShare, onDelete, onPreview }) => {
149153
>
150154
Preview
151155
</MenuItem>
152-
<MenuItem
153-
component={Button}
154-
onClick={handleMenuItemClick(onShare, document)}
155-
startIcon={<ShareIcon sx={iconSize} />}
156-
sx={iconStyling}
157-
>
158-
Share
159-
</MenuItem>
160-
<MenuItem
161-
component={Button}
162-
onClick={handleMenuItemClick(onDelete, document)}
163-
startIcon={<DeleteOutlineOutlinedIcon sx={iconSize} />}
164-
sx={iconStyling}
165-
>
166-
Delete
167-
</MenuItem>
156+
{`${profileWebId}` === 'undefined' && (
157+
<MenuItem
158+
component={Button}
159+
onClick={handleMenuItemClick(onShare, document)}
160+
startIcon={<ShareIcon sx={iconSize} />}
161+
sx={iconStyling}
162+
>
163+
Share
164+
</MenuItem>
165+
)}
166+
{`${profileWebId}` === 'undefined' && (
167+
<MenuItem
168+
component={Button}
169+
onClick={handleMenuItemClick(onDelete, document)}
170+
startIcon={<DeleteOutlineOutlinedIcon sx={iconSize} />}
171+
sx={iconStyling}
172+
>
173+
Delete
174+
</MenuItem>
175+
)}
168176
</Menu>
169177
</Card>
170178
</Box>

src/components/Documents/DocumentTable.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const DocumentTable = ({ handleAclPermissionsModal, handleSelectDeleteDoc }) =>
3737
const { documentListObject, loadingDocuments } = useContext(DocumentListContext);
3838

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

4142
/**
4243
* Handles the local display of a document by opening it in a new window.
@@ -98,7 +99,7 @@ const DocumentTable = ({ handleAclPermissionsModal, handleSelectDeleteDoc }) =>
9899
}}
99100
data-testid="document-table"
100101
>
101-
{isMobile ? (
102+
{isMobile || isSmallScreenHeight ? (
102103
<DocumentsMobile documents={documents} handlers={handlers} data-testid="documents-mobile" />
103104
) : (
104105
<DocumentsDesktop

0 commit comments

Comments
 (0)