Skip to content

Commit

Permalink
#1147 - show organisation category in listing and in home page title
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed May 3, 2024
1 parent 980aa17 commit 6fa2833
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/adminApp/Organisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const OrganisationList = ({ history, ...props }) => {
<List {...props} bulkActions={false} filter={{ searchURI: "find" }} filters={<OrganisationFilter />}>
<Datagrid>
<TextField source="name" label="Name" />
<TextField source="category" label="Category" />
<ReferenceField label="Parent organisation" source="parentOrganisationId" reference="organisation" linkType="show" allowEmpty>
<TextField source="name" />
</ReferenceField>
Expand Down
3 changes: 2 additions & 1 deletion src/rootApp/ducks.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export default function(state = initialState, action) {
organisation: {
id: action.payload.organisationId,
name: action.payload.organisationName,
usernameSuffix: action.payload.usernameSuffix
usernameSuffix: action.payload.usernameSuffix,
organisationCategory: action.payload.organisationCategory
},
userInfo: action.payload
};
Expand Down
24 changes: 7 additions & 17 deletions src/rootApp/views/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ import {
Help
} from "@material-ui/icons";

const Homepage = ({ userInfo }) => {
const Homepage = ({ userInfo, organisation }) => {
httpClient.saveAuthTokenForAnalyticsApp();

const showAnalytics = UserInfo.hasPrivilege(userInfo, Privilege.PrivilegeType.Analytics);
const showDataEntryApp = UserInfo.hasPrivilege(
userInfo,
Privilege.PrivilegeType.ViewEditEntitiesOnDataEntryApp
);
const showDataEntryApp = UserInfo.hasPrivilege(userInfo, Privilege.PrivilegeType.ViewEditEntitiesOnDataEntryApp);

return (
<ScreenWithAppBar appbarTitle={"Avni Web Console"}>
<ScreenWithAppBar appbarTitle={`Avni Web Console - ${organisation.organisationCategory}`}>
<Grid container justifyContent="center">
<HomePageCard
href={"/#/admin/user"}
Expand Down Expand Up @@ -62,11 +59,7 @@ const Homepage = ({ userInfo }) => {
name={"Translations"}
customIconComponent={<Translate color="primary" style={{ fontSize: 100 }} />}
/>
<HomePageCard
href={"/#/export"}
name={"Reports"}
customIconComponent={<Assessment color="primary" style={{ fontSize: 100 }} />}
/>
<HomePageCard href={"/#/export"} name={"Reports"} customIconComponent={<Assessment color="primary" style={{ fontSize: 100 }} />} />
{showDataEntryApp && (
<HomePageCard
href={"/#/app"}
Expand All @@ -76,11 +69,7 @@ const Homepage = ({ userInfo }) => {
)}
{showAnalytics && (
<HomePageCard
href={
ApplicationContext.isDevEnv()
? `http://localhost:3000/avni-media?authToken=${httpClient.getAuthToken()}`
: "/avni-media"
}
href={ApplicationContext.isDevEnv() ? `http://localhost:3000/avni-media?authToken=${httpClient.getAuthToken()}` : "/avni-media"}
name={"Media Viewer "}
customIconComponent={<Collections color="primary" style={{ fontSize: 100 }} />}
/>
Expand All @@ -96,6 +85,7 @@ const Homepage = ({ userInfo }) => {
};

const mapStateToProps = state => ({
userInfo: state.app.userInfo
userInfo: state.app.userInfo,
organisation: state.app.organisation
});
export default connect(mapStateToProps)(Homepage);

0 comments on commit 6fa2833

Please sign in to comment.