Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…icro-front-ends into bugfix/FWF-3866-translation-fixes
  • Loading branch information
Ajay-aot committed Jan 15, 2025
2 parents f94ddfc + 96b36e3 commit 21411a3
Show file tree
Hide file tree
Showing 25 changed files with 189 additions and 70 deletions.
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

Mark items as `Added`, `Changed`, `Fixed`, `Modified`, `Removed`, `Untested Features`, `Upcoming Features`, `Known Issues`

## 7.0.0 - 2025-01-10

`Added`

**forms-flow-admin**
* Added permission selection option in role creation modal

**forms-flow-theme**
* Added new root variables to support the updated UI design
* Added style changes to support new design

**forms-flow-components**
* New micro-frontend to include reusable UI components
* Added new reusable components:
* Svg Icons
* Svg Images
* Custom components:
* Modals
* Button
* Form elements
* Table elements
<br><br>


`Modified`

**forms-flow-admin**
* Renamed Admin menu as Manage and moved to sidebar

**forms-flow-nav**
* Modified Navbar to sidebar with updated design







## 6.0.2 - 2024-06-05

`Generic Changes`
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ This module contains all the common functionalties used by micro front-ends. The

This module contains the common style sheet shared by all micro-front-ends. This module supports theming by providing the option to use desired themes by modifying the css variables.

5. forms-flow-components

This module contains reusable UI components.

All the modules are built with `single-spa`, a javascript router for micro front-end microsevices.

## Prerequisites
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.0.0-alpha
v7.1.0-alpha
4 changes: 2 additions & 2 deletions forms-flow-admin/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 forms-flow-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formsflow/admin",
"version": "7.0.0-alpha",
"version": "7.1.0-alpha",
"scripts": {
"start": "webpack serve",
"start:standalone": "webpack serve --env standalone",
Expand Down
6 changes: 1 addition & 5 deletions forms-flow-admin/src/components/roles/roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const Roles = React.memo((props: any) => {
setDisabled(
!(
payload.name?.trim() &&
payload.description?.trim() &&
payload.permissions.length !== 0
)
);
Expand All @@ -89,7 +88,6 @@ const Roles = React.memo((props: any) => {
setDisabled(
!(
editCandidate.name?.trim() &&
editCandidate.description?.trim() &&
editCandidate.permissions.length !== 0
)
);
Expand Down Expand Up @@ -181,7 +179,6 @@ const Roles = React.memo((props: any) => {
const validateRolePayload = (payload) => {
return !(
payload.name === "" ||
payload.description === "" ||
payload.permissions.length === 0
);
};
Expand Down Expand Up @@ -272,6 +269,7 @@ const Roles = React.memo((props: any) => {
rowData.name,
null,
null,
null,
(results) => {
setUsers(results.data);
setLoading(false);
Expand Down Expand Up @@ -424,7 +422,6 @@ const Roles = React.memo((props: any) => {
<Form.Label htmlFor="role-description" className="mt-2">
{t("Description")}
</Form.Label>
<i className="text-danger">*</i>
<Form.Control
id="role-description"
as="textarea"
Expand Down Expand Up @@ -514,7 +511,6 @@ const Roles = React.memo((props: any) => {
<Form.Label htmlFor="edit-description" className="mt-2">
{t("Description")}
</Form.Label>
<i style={{ color: "#e00" }}>*</i>
<Form.Control
id="edit-description"
as="textarea"
Expand Down
10 changes: 8 additions & 2 deletions forms-flow-admin/src/components/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ const UserManagement = React.memo((props: any) => {
const [filter, setFilter] = React.useState(undefined);
const [total, setTotal] = React.useState(undefined);
const { t } = useTranslation();

const [sizePerPage, setSizePerPage] = React.useState(5);

React.useEffect(() => {
if (filter === undefined) return;
setLoading(true);
fetchUsers(
filter,
1,
search,
sizePerPage,
(results) => {
setUsers(removeTenantIdFromUserRoles(results.data));
setInvalidated(false);
Expand All @@ -54,6 +56,7 @@ const UserManagement = React.memo((props: any) => {
filter,
1,
search,
sizePerPage,
(results) => {
setUsers(removeTenantIdFromUserRoles(results.data));
setInvalidated(false);
Expand All @@ -80,6 +83,7 @@ const UserManagement = React.memo((props: any) => {
filter,
pageNo,
search,
sizePerPage,
(results) => {
setUsers(removeTenantIdFromUserRoles(results.data));
setTotal(results.count);
Expand All @@ -103,6 +107,7 @@ const UserManagement = React.memo((props: any) => {
null,
pageNo,
null,
sizePerPage,
(results) => {

setUsers(removeTenantIdFromUserRoles(results.data));
Expand All @@ -122,7 +127,7 @@ const UserManagement = React.memo((props: any) => {
setError(err);
toast.error(t("Failed to fetch roles!"))
});
}, []);
}, [sizePerPage]);

const removeTenantIdFromUserRoles = (data)=>{
let updatedUserData = []
Expand Down Expand Up @@ -151,6 +156,7 @@ const UserManagement = React.memo((props: any) => {
setFilter={setFilter}
total={total}
error={error}
limit = {{sizePerPage , setSizePerPage}}
/>
</>
);
Expand Down
6 changes: 3 additions & 3 deletions forms-flow-admin/src/components/users/users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const Users = React.memo((props: any) => {
const [error, setError] = React.useState(null); // Initialize error state with null instead of undefined
const [loading, setLoading] = React.useState(false);
const [activePage, setActivePage] = React.useState(1);
const [sizePerPage, setSizePerPage] = React.useState(5);
const [selectedFilter, setSelectedFilter] = React.useState(null); // Initialize selectedFilter with null
const [searchKey, setSearchKey] = React.useState("");
const [showInviteModal, setShowInviteModal] = React.useState(false); // Add state for managing invite modal
Expand Down Expand Up @@ -113,7 +112,8 @@ const Users = React.memo((props: any) => {
};

const handleLimitChange = (newLimit: number) => {
setSizePerPage(newLimit);
props.limit?.setSizePerPage(newLimit);
props.page.setPageNo(1);
setActivePage(1);
};

Expand Down Expand Up @@ -524,7 +524,7 @@ const Users = React.memo((props: any) => {
<table className="table mt-3">
<tfoot>
<TableFooter
limit={sizePerPage}
limit={props?.limit?.sizePerPage}
activePage={activePage}
totalCount={props.total}
handlePageChange={handlePageChange}
Expand Down
6 changes: 6 additions & 0 deletions forms-flow-admin/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const Admin = React.memo(({ props }: any) => {
}
}, []);

React.useEffect(()=>{
if(instance){
publish("FF_AUTH", instance);
}
},[instance])

React.useEffect(()=>{
if(!isAuth) return
const locale = localStorage.getItem("i18nextLng")
Expand Down
4 changes: 3 additions & 1 deletion forms-flow-admin/src/services/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ export const fetchUsers = (
group: string | null,
pageNo: number | null,
search: string | null,
sizePerPage : number | null ,
callback: any,
errorHandler: any,
role = true,
count = true
) => {
let url = `${API.GET_USERS}?role=${role}&count=${count}`;
if (group) url += `&memberOfGroup=${group}`;
if (pageNo) url += `&pageNo=${pageNo}&limit=5`;
if (pageNo) url += `&pageNo=${pageNo}`;
if(sizePerPage) url += `&limit=${sizePerPage}`;
if (search) url += `&search=${search}`;

RequestService.httpGETRequest(url)
Expand Down
4 changes: 2 additions & 2 deletions forms-flow-components/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 forms-flow-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@formsflow/components",
"version": "7.0.0-alpha",
"version": "7.1.0-alpha",
"scripts": {
"start": "webpack serve",
"start:standalone": "webpack serve --env standalone",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React ,{ FC } from "react";
import React, { FC } from "react";
import { useTranslation } from "react-i18next";
import { InfoIcon } from "../SvgIcons/index";

Expand All @@ -14,16 +14,24 @@ export const CustomInfo: FC<CustomInfoProps> = ( {
content ,
className ,
}) => {
const { t } = useTranslation();
return (
<div className={`info-panel ${className}`}>
<div className="d-flex align-items-center">
<InfoIcon />
<div className="field-label ms-2">{t(heading)}</div>
</div>
<div className="info-content">
{t(content)}
</div>
const { t } = useTranslation();

// Replace `\n` with <br /> tags and use the line itself as a key
const formattedContent = content.split("\n").map((line) => (
<React.Fragment key={line.trim().replace(/\s+/g, "-")}>
{t(line)}
<br />
</React.Fragment>
));


return (
<div className={`info-panel ${className}`}>
<div className="d-flex align-items-center">
<InfoIcon />
<div className="field-label ms-2">{t(heading)}</div>
</div>
)
<div className="info-content">{formattedContent}</div> {/* Render formatted content */}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export const FormBuilderModal: React.FC<BuildFormModalProps> = React.memo(
isInvalid={!!nameError}
feedback={nameError}
turnOnLoader={isFormNameValidating}
maxLength={200}
/>
<FormTextArea
name="description"
Expand Down
Loading

0 comments on commit 21411a3

Please sign in to comment.