Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Infinite scroll to all tag screens & refactor code for better readability (GSoC) #2387

Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
66e1af2
add people to tag functaionality
meetulr Oct 25, 2024
edb8360
minor change
meetulr Oct 25, 2024
689ad90
more translations
meetulr Oct 25, 2024
abaf86e
minor change
meetulr Oct 26, 2024
7b7b6bf
add a variable for page size
meetulr Oct 26, 2024
72b6fd3
add tag actions
meetulr Oct 26, 2024
3b97043
add tests
meetulr Oct 26, 2024
6c13484
translations
meetulr Oct 26, 2024
76f5fbe
change to infinite scroll
meetulr Oct 27, 2024
d022c8d
add subtags infinite scroll
meetulr Oct 27, 2024
27227a9
Merge branch 'tagActions' into changeToInfiniteScroll
meetulr Oct 27, 2024
d11a6ee
extract common variables to utils
meetulr Oct 27, 2024
01b4b65
minor correction
meetulr Oct 27, 2024
c882dd6
Merge branch 'tagActions' into changeToInfiniteScroll
meetulr Oct 27, 2024
ba59202
more design adjustments
meetulr Oct 27, 2024
a59da70
add tests
meetulr Oct 27, 2024
f773005
add scrollbar for infinite scroll
meetulr Oct 27, 2024
e42b8fe
extract infinite scroll loader
meetulr Oct 27, 2024
ab3310a
minor adjustment
meetulr Oct 27, 2024
b223e21
refactoring
meetulr Oct 27, 2024
1b4b913
Merge branch 'develop' of https://github.com/PalisadoesFoundation/tal…
meetulr Oct 27, 2024
a8bca91
exclude ManageTag from countline check
meetulr Oct 27, 2024
58af286
fix linting
meetulr Oct 27, 2024
59f5e03
fix linting
meetulr Oct 27, 2024
879ef42
fix linting
meetulr Oct 27, 2024
6a79d51
make coderabbit suggested changes
meetulr Oct 28, 2024
9bc25d7
more changes
meetulr Oct 28, 2024
926f766
more changes
meetulr Oct 28, 2024
d3e91ac
minor correction
meetulr Oct 28, 2024
2a49ea0
add error component for tagNode subtags query
meetulr Oct 28, 2024
052aead
fix translation
meetulr Oct 28, 2024
d8d657a
fix translation
meetulr Oct 28, 2024
e9a86f8
Merge branch 'tagActions' into refactoringAndDesignAdjustments
meetulr Oct 28, 2024
4ae2507
remove unused css classes
meetulr Oct 28, 2024
ffbdffc
refactor ManageTag file to reduce its size
meetulr Oct 30, 2024
f4c7814
update pull-request check
meetulr Oct 30, 2024
95a1138
minor adjustments
meetulr Oct 30, 2024
4efe79e
minor correction
meetulr Oct 30, 2024
bbab01c
Merge branch 'develop' of https://github.com/PalisadoesFoundation/tal…
meetulr Oct 30, 2024
6f65f9f
minor change
meetulr Oct 30, 2024
eb5b7ea
correction
meetulr Oct 30, 2024
ee1cf2d
minor changes
meetulr Oct 30, 2024
5ac6cbe
minor change
meetulr Oct 30, 2024
9626c68
coderabbitai changes
meetulr Oct 30, 2024
9be6fa8
more changes
meetulr Oct 30, 2024
63febd0
fix dataGrid classes
meetulr Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tag actions
  • Loading branch information
meetulr committed Oct 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 72b6fd3d13a36dd82d05b8325a867a363ee33996
14 changes: 12 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -335,11 +335,21 @@
"subTags": "Sub Tags",
"assignedToAll": "Tag Assigned to All",
"successfullyAssignedToPeople": "Tag assigned successfully",
"assignPeople": "Assign",
"errorOccurredWhileLoadingMembers": "Error occured while loading members",
"userName": "User Name",
"actions": "Actions",
"noOneSelected": "No One Selected"
"noOneSelected": "No One Selected",
"assignToTags": "Assign to Tags",
"removeFromTags": "Remove from Tags",
"assign": "Assign",
"remove": "Remove",
"successfullyAssignedToTags": "Successfully Assigned to Tags",
"successfullyRemovedFromTags": "Successfully Removed from Tags",
"errorOccurredWhileLoadingOrganizationUserTags": "Error occured while loading organization tags",
"removeUserTag": "Delete Tag",
"removeUserTagMessage": "Do you want to delete this tag? It delete all the sub tags and all the associations.",
"tagDetails": "Tag Details",
"tagName": "Name"
},
"userListCard": {
"addAdmin": "Add Admin",
14 changes: 12 additions & 2 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
@@ -330,7 +330,6 @@
"unassignUserTag": "Désassigner l'étiquette",
"unassignUserTagMessage": "Voulez-vous retirer l'étiquette de cet utilisateur?",
"successfullyUnassigned": "Étiquette retirée de l'utilisateur",
"addPeople": "Ajouter des personnes",
"add": "Ajouter",
"subTags": "Sous-étiquettes",
"assignedToAll": "Étiquette attribuée à tous",
@@ -339,7 +338,18 @@
"errorOccurredWhileLoadingMembers": "Erreur survenue lors du chargement des membres",
"userName": "Nom d'utilisateur",
"actions": "Actions",
"noOneSelected": "Personne sélectionnée"
"noOneSelected": "Personne sélectionnée",
"assignToTags": "Attribuer aux tags",
"removeFromTags": "Retirer des tags",
"assign": "Attribuer",
"remove": "Retirer",
"successfullyAssignedToTags": "Attribué aux tags avec succès",
"successfullyRemovedFromTags": "Retiré des tags avec succès",
"errorOccurredWhileLoadingOrganizationUserTags": "Erreur lors du chargement des tags de l'organisation",
"removeUserTag": "Supprimer le tag",
"removeUserTagMessage": "Voulez-vous supprimer ce tag ? Cela supprimera tous les sous-tags et toutes les associations.",
"tagDetails": "Détails du tag",
"tagName": "Nom"
},
"userListCard": {
"addAdmin": "Ajouter un administrateur",
14 changes: 12 additions & 2 deletions public/locales/hi/translation.json
Original file line number Diff line number Diff line change
@@ -335,11 +335,21 @@
"subTags": "उप-टैग्स",
"assignedToAll": "सभी को टैग असाइन किया गया",
"successfullyAssignedToPeople": "टैग सफलतापूर्वक असाइन किया गया",
"assignPeople": "असाइन करें",
"errorOccurredWhileLoadingMembers": "सदस्यों को लोड करते समय त्रुटि हुई",
"userName": "उपयोगकर्ता नाम",
"actions": "क्रियाएँ",
"noOneSelected": "कोई चयनित नहीं"
"noOneSelected": "कोई चयनित नहीं",
"assignToTags": "टैग्स को असाइन करें",
"removeFromTags": "टैग्स से हटाएं",
"assign": "असाइन करें",
"remove": "हटाएं",
"successfullyAssignedToTags": "सफलतापूर्वक टैग्स को असाइन किया गया",
"successfullyRemovedFromTags": "सफलतापूर्वक टैग्स से हटाया गया",
"errorOccurredWhileLoadingOrganizationUserTags": "संगठन टैग्स को लोड करते समय त्रुटि हुई",
"removeUserTag": "टैग हटाएं",
"removeUserTagMessage": "क्या आप इस टैग को हटाना चाहते हैं? यह सभी उप-टैग्स और सभी संबंधों को हटा देगा।",
"tagDetails": "टैग विवरण",
"tagName": "नाम"
},
"userListCard": {
"addAdmin": "व्यवस्थापक जोड़ें",
14 changes: 12 additions & 2 deletions public/locales/sp/translation.json
Original file line number Diff line number Diff line change
@@ -335,11 +335,21 @@
"subTags": "Subetiquetas",
"assignedToAll": "Etiqueta asignada a todos",
"successfullyAssignedToPeople": "Etiqueta asignada con éxito",
"assignPeople": "Asignar",
"errorOccurredWhileLoadingMembers": "Error al cargar los miembros",
"userName": "Nombre de usuario",
"actions": "Acciones",
"noOneSelected": "Nadie seleccionado"
"noOneSelected": "Nadie seleccionado",
"assignToTags": "Asignar a etiquetas",
"removeFromTags": "Eliminar de etiquetas",
"assign": "Asignar",
"remove": "Eliminar",
"successfullyAssignedToTags": "Asignado a etiquetas con éxito",
"successfullyRemovedFromTags": "Eliminado de etiquetas con éxito",
"errorOccurredWhileLoadingOrganizationUserTags": "Error al cargar las etiquetas de la organización",
"removeUserTag": "Eliminar etiqueta",
"removeUserTagMessage": "¿Desea eliminar esta etiqueta? Esto eliminará todas las subetiquetas y todas las asociaciones.",
"tagDetails": "Detalles de la etiqueta",
"tagName": "Nombre"
},
"userListCard": {
"joined": "Unido",
14 changes: 12 additions & 2 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
@@ -335,11 +335,21 @@
"subTags": "子标签",
"assignedToAll": "标签分配给所有人",
"successfullyAssignedToPeople": "标签分配成功",
"assignPeople": "分配",
"errorOccurredWhileLoadingMembers": "加载成员时出错",
"userName": "用户名",
"actions": "操作",
"noOneSelected": "未选择任何人"
"noOneSelected": "未选择任何人",
"assignToTags": "分配到标签",
"removeFromTags": "从标签中移除",
"assign": "分配",
"remove": "移除",
"successfullyAssignedToTags": "成功分配到标签",
"successfullyRemovedFromTags": "成功从标签中移除",
"errorOccurredWhileLoadingOrganizationUserTags": "加载组织标签时出错",
"removeUserTag": "删除标签",
"removeUserTagMessage": "您要删除此标签吗?这将删除所有子标签和所有关联。",
"tagDetails": "标签详情",
"tagName": "名称"
},
"userListCard": {
"addAdmin": "添加管理员",
34 changes: 34 additions & 0 deletions src/GraphQl/Mutations/TagMutations.ts
Original file line number Diff line number Diff line change
@@ -87,3 +87,37 @@ export const ADD_PEOPLE_TO_TAG = gql`
}
}
`;

/**
* GraphQL mutation to assign people to multiple tags.
*
* @param currentTagId - Id of the current tag.
* @param selectedTagIds - Ids of the selected tags to be assined.
*/

export const ASSIGN_TO_TAGS = gql`
mutation AssignToUserTags($currentTagId: ID!, $selectedTagIds: [ID!]!) {
assignToUserTags(
input: { currentTagId: $currentTagId, selectedTagIds: $selectedTagIds }
) {
_id
}
}
`;

/**
* GraphQL mutation to remove people from multiple tags.
*
* @param currentTagId - Id of the current tag.
* @param selectedTagIds - Ids of the selected tags to be removed from.
*/

export const REMOVE_FROM_TAGS = gql`
mutation RemoveFromUserTags($currentTagId: ID!, $selectedTagIds: [ID!]!) {
removeFromUserTags(
input: { currentTagId: $currentTagId, selectedTagIds: $selectedTagIds }
) {
_id
}
}
`;
2 changes: 1 addition & 1 deletion src/components/AddPeopleToTag/AddPeopleToTag.tsx
Original file line number Diff line number Diff line change
@@ -365,7 +365,7 @@ const AddPeopleToTag: React.FC<InterfaceAddPeopleToTagProps> = ({
variant="primary"
data-testid="assignPeopleBtn"
>
{t('assignPeople')}
{t('assign')}
</Button>
</Modal.Footer>
</Form>
174 changes: 174 additions & 0 deletions src/components/TagActions/TagActions.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
.btnsContainer {
display: flex;
margin: 2rem 0;
}

.btnsContainer .btnsBlock {
display: flex;
width: max-content;
}

.btnsContainer .btnsBlock button {
margin-left: 1rem;
display: flex;
justify-content: center;
align-items: center;
}

.btnsContainer .input {
flex: 1;
position: relative;
max-width: 60%;
justify-content: space-between;
}

.btnsContainer input {
outline: 1px solid var(--bs-gray-400);
}

.btnsContainer .input button {
width: 52px;
}

@media (max-width: 1020px) {
.btnsContainer {
flex-direction: column;
margin: 1.5rem 0;
}

.btnsContainer .btnsBlock {
margin: 1.5rem 0 0 0;
justify-content: space-between;
}

.btnsContainer .btnsBlock button {
margin: 0;
}

.btnsContainer .btnsBlock div button {
margin-right: 1.5rem;
}
}

/* For mobile devices */

@media (max-width: 520px) {
.btnsContainer {
margin-bottom: 0;
}

.btnsContainer .btnsBlock {
display: block;
margin-top: 1rem;
margin-right: 0;
}

.btnsContainer .btnsBlock div {
flex: 1;
}

.btnsContainer .btnsBlock div[title='Sort organizations'] {
margin-right: 0.5rem;
}

.btnsContainer .btnsBlock button {
margin-bottom: 1rem;
margin-right: 0;
width: 100%;
}
}

.errorContainer {
min-height: 100vh;
}

.errorMessage {
margin-top: 25%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

.errorIcon {
transform: scale(1.5);
color: var(--bs-danger);
margin-bottom: 1rem;
}

.tableHeader {
background-color: var(--bs-primary);
color: var(--bs-white);
font-size: 1rem;
}

.rowBackground {
background-color: var(--bs-white);
max-height: 120px;
}

.tagsBreadCrumbs {
color: var(--bs-gray);
cursor: pointer;
}

.tagsBreadCrumbs:hover {
color: var(--bs-blue);
font-weight: 600;
text-decoration: underline;
}

.scrollContainer {
max-height: 100px; /* Adjust as needed */
overflow-y: auto;
margin-bottom: 1rem;
}

.tagBadge {
display: flex;
align-items: center;
padding: 5px 10px;
border-radius: 12px;
background-color: #f8f9fa; /* Light background */
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
max-width: calc(100% - 30px); /* Ensure it fits within the container */
}

.removeFilterIcon {
cursor: pointer;
}

.scrContainer {
max-height: 300px;
overflow: scroll;
/* padding-right: 8px; */
}

.allTagsHeading {
color: rgb(77, 76, 76);
font-weight: 600;
}

/* SimpleLoader.css */
.simpleLoader {
display: flex;
justify-content: start;
align-items: center;
width: 100%;
height: 100%;
}

.spinner {
width: 40px;
height: 40px;
border: 4px solid var(--bs-gray);
border-top-color: var(--bs-gray);
border-radius: 50%;
animation: spin 0.6s linear infinite;
}

@keyframes spin {
to {
transform: rotate(360deg);
}
}
Loading