Skip to content

OfficeAccessCard editing - UI changes#1935

Merged
adarshm11 merged 13 commits into
editaliasfrom
editalias-frontend
Oct 21, 2025
Merged

OfficeAccessCard editing - UI changes#1935
adarshm11 merged 13 commits into
editaliasfrom
editalias-frontend

Conversation

@adarshm11

Copy link
Copy Markdown
Contributor

No description provided.

DavidN016 and others added 7 commits October 18, 2025 10:33
- Implemented a new endpoint to edit card aliases, including validation for input.
- Updated the OfficeAccessCard utility to support alias editing.
- Enhanced the CardReader component to allow users to edit card aliases directly in the UI.
- Added corresponding tests to ensure proper functionality and error handling for the new feature.
- Introduced a new audit log action for alias edits.

@evanugarte evanugarte left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

point this pr to editalias instead of dev, git workshop remember

that way the diff will just be the frontend changes

@adarshm11
adarshm11 changed the base branch from dev to editalias October 18, 2025 18:30
Comment thread src/Pages/CardReader/CardReader.js Outdated
const token = user.token;

// Local pencil icon for edit functionality
const pencilSymbol = (color = '#6b7280') => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put this in svg.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +104 to +112
function handleEditClick(card) {
setEditingCardId(card._id);
setEditedAlias(card.alias);
}

function handleCancelEdit() {
setEditingCardId(null);
setEditedAlias('');
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put these both in 1 function like

if editing
  do stuff
  return

// do cancel stuff here

Comment thread src/Pages/CardReader/CardReader.js Outdated
Comment on lines +149 to +153
if (e.key === 'Enter') {
handleSaveEdit(card._id);
} else if (e.key === 'Escape') {
handleCancelEdit();
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a single function, like handleEditKeyDown

Comment thread src/Pages/CardReader/CardReader.js Outdated
Comment on lines +206 to +209
<svg width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='#ef4444' strokeWidth='2' strokeLinecap='round' strokeLinejoin='round'>
<line x1='18' y1='6' x2='6' y2='18'></line>
<line x1='6' y1='6' x2='18' y2='18'></line>
</svg>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whatever svg this is put it in svg.js

@adarshm11
adarshm11 force-pushed the editalias branch 2 times, most recently from a902e38 to a44449f Compare October 20, 2025 04:34
Comment thread src/Pages/CardReader/CardReader.js Outdated
Comment on lines +143 to +159
{isEditing ? (
<input
type='text'
value={editedAlias}
onChange={(e) => setEditedAlias(e.target.value)}
onKeyDown={(e) => handleEditKeyDown(e.key)}
className='bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded text-gray-700 dark:text-white font-medium m-0 px-1 py-0 focus:outline-none focus:ring-1 focus:ring-blue-500'
style={{ width: '16ch' }}
autoFocus
/>
) : (
<div style={{ width: '16ch', display: 'flex', justifyContent: 'center', overflow: 'hidden' }}>
<span style={{ textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }}>
{card.alias}
</span>
</div>
)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this a function call, lke

renderInputOrAlias

and the function is like

if isEditing
  return input

return div with alias

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/Pages/CardReader/CardReader.js Outdated
const getColumnClassName = (columnName) => {
let className = 'px-6 py-3 whitespace-nowrap ';
if(columnName === 'lastVerifiedAt' | columnName === 'registrationDate'){
if(columnName === 'lastVerifiedAt' || columnName === 'registrationDate'){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use includes here like

[1,2].includes(1) returns true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@adarshm11
adarshm11 merged commit ea219da into editalias Oct 21, 2025
@adarshm11
adarshm11 deleted the editalias-frontend branch October 21, 2025 04:47
adarshm11 added a commit that referenced this pull request Oct 21, 2025
* Add edit alias functionality for OfficeAccessCard (#1900)

- Implemented a new endpoint to edit card aliases, including validation for input.
- Updated the OfficeAccessCard utility to support alias editing.
- Enhanced the CardReader component to allow users to edit card aliases directly in the UI.
- Added corresponding tests to ensure proper functionality and error handling for the new feature.
- Introduced a new audit log action for alias edits.

* fixed lint issues

* fixed issues with edit alias

* fixed input re-sizing

* fix token decoding for office cards

* fix failing test

* separate frontend changes

* Add edit alias functionality for OfficeAccessCard (#1900)

- Implemented a new endpoint to edit card aliases, including validation for input.
- Updated the OfficeAccessCard utility to support alias editing.
- Enhanced the CardReader component to allow users to edit card aliases directly in the UI.
- Added corresponding tests to ensure proper functionality and error handling for the new feature.
- Introduced a new audit log action for alias edits.

* fixed lint issues

* fixed issues with edit alias

* fixed input re-sizing

* fix token decoding for office cards

* fix failing test

* separate frontend changes

* modify required checks for /edit

* addressed requested changes

* try to fix failing test

* try to fix that failing test one more time

* remove this test cuz it wont work

* OfficeAccessCard editing - UI changes (#1935)

* Add edit alias functionality for OfficeAccessCard (#1900)

- Implemented a new endpoint to edit card aliases, including validation for input.
- Updated the OfficeAccessCard utility to support alias editing.
- Enhanced the CardReader component to allow users to edit card aliases directly in the UI.
- Added corresponding tests to ensure proper functionality and error handling for the new feature.
- Introduced a new audit log action for alias edits.

* fixed lint issues

* fixed issues with edit alias

* fixed input re-sizing

* fix token decoding for office cards

* fix failing test

* card reader frontend

* rebase

* undo diff

* fixed requested changes

* fixed requested changes

---------

Co-authored-by: DavidN016 <david.a.nguyen01@sjsu.edu>

---------

Co-authored-by: DavidN016 <david.a.nguyen01@sjsu.edu>
Co-authored-by: adarshm11 <amlearning2023@gmail.com>
Co-authored-by: adarsh <110150037+adarshm11@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants