Skip to content

Commit

Permalink
feat: app context expansion message
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggling committed Mar 18, 2024
1 parent 9029eb4 commit 8e10993
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useFavorites } from '@portal/core';
import styled from 'styled-components';
import { MessageCard } from '@portal/ui';

const Styles = {
AppMessageWrapper: styled.div`
padding: 1rem 0;
`,
};

const APP_COUNT = 15;

export const AppContextMessage = () => {
const { apps } = useFavorites();
return (
<>
{apps && apps.length < APP_COUNT && (
<Styles.AppMessageWrapper>
<MessageCard
title="Application and Context Expansion"
messages={[
"Currently, we're striving to expand the availability of applications to accommodate both facility and project contexts.",
"Due to data and certain applications lacking support for all context types, we're unable to offer all applications for all contexts at this time.",
]}
/>
</Styles.AppMessageWrapper>
)}
</>
);
};
1 change: 1 addition & 0 deletions client/packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export * from './components/app-group/AppGroup';
export { GroupWrapper } from './components/group-wrapper/GroupWrapper';
export * from './components/app-search/AppSearchBar';
export * from './components/menu';
export * from './components/app-context-message/AppContextMessage';
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const useFavorites = () => {
}, [isPinned, appCategories]);

return {
apps,
appGroups: appGroupsWithPinned,
favorites: favoritesWithDisabled,
disabledAppKeys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useState, useMemo } from 'react';
import { useFeature } from '@equinor/fusion-framework-react-app/feature-flag';
import { useFavorites } from '@portal/core';
import styled from 'styled-components';
import { AppGroup, LoadingMenu } from '@portal/components';
import { AppContextMessage, AppGroup, LoadingMenu } from '@portal/components';

const Styles = {
Divider: styled.div`
Expand Down Expand Up @@ -59,6 +59,9 @@ const Styles = {
bottom: 1rem;
right: 1rem;
`,
AppMessageWrapper: styled.div`
padding: 1rem 0;
`,
};

export function MenuGroups() {
Expand Down Expand Up @@ -139,56 +142,59 @@ export function MenuGroups() {
/>
</Styles.Feature>
</Styles.Divider>
{displayAppGroups && !!displayAppGroups?.length ? (
activeItem.includes('Pinned Apps') && favorites?.length === 0 ? (
<InfoMessage>
Looks like you do not have any pinned apps yet. <br /> Click the star icon on apps
to add them to the pinned app section.
</InfoMessage>
) : (
<Styles.Wrapper>
{displayAppGroups &&
displayAppGroups.map((appGroup) => (
<div key={appGroup.name}>
<AppGroup
dark={false}
group={appGroup}
onClick={(app, e) => {
if (app.isDisabled) {
e.preventDefault();
return;
}
dispatchEvent(
{
name: 'onAppNavigation',
},

{
appKey: app.key,
isFavorite: app.isPinned,
source: 'app-menu',
}
);

closeMenu();
}}
onFavorite={(app) => addFavorite(app.key)}
/>
</div>
))}
</Styles.Wrapper>
)
) : (
<>
{searchText ? (
<InfoMessage>No results found for your search.</InfoMessage>
) : !hasApps ? (
<div>
<AppContextMessage />
{displayAppGroups && !!displayAppGroups?.length ? (
activeItem.includes('Pinned Apps') && favorites?.length === 0 ? (
<InfoMessage>
Please select a context to display a list of applications.
Looks like you do not have any pinned apps yet. <br /> Click the star icon on
apps to add them to the pinned app section.
</InfoMessage>
) : null}
</>
)}
) : (
<Styles.Wrapper>
{displayAppGroups &&
displayAppGroups.map((appGroup) => (
<div key={appGroup.name}>
<AppGroup
dark={false}
group={appGroup}
onClick={(app, e) => {
if (app.isDisabled) {
e.preventDefault();
return;
}
dispatchEvent(
{
name: 'onAppNavigation',
},

{
appKey: app.key,
isFavorite: app.isPinned,
source: 'app-menu',
}
);

closeMenu();
}}
onFavorite={(app) => addFavorite(app.key)}
/>
</div>
))}
</Styles.Wrapper>
)
) : (
<>
{searchText ? (
<InfoMessage>No results found for your search.</InfoMessage>
) : !hasApps ? (
<InfoMessage>
Please select a context to display a list of applications.
</InfoMessage>
) : null}
</>
)}
</div>
</>
)}
</Styles.MenuWrapper>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from 'styled-components';
import { AppGroup } from '@portal/components';
import { AppContextMessage, AppGroup } from '@portal/components';
import { appGroupArraySort, useFavorites } from '@portal/core';

import { ProgressLoader } from '@equinor/portal-ui';
Expand All @@ -9,6 +9,7 @@ const Styles = {
Wrapper: styled.div`
column-count: 3;
max-width: calc(100vw - 490px);
gap: 1.5rem;
@media only screen and (max-width: 1500px) {
Expand Down Expand Up @@ -39,34 +40,37 @@ export const AllApps = () => {
);
}
return (
<Styles.Wrapper>
{appGroups &&
appGroups.sort(appGroupArraySort).map((appGroup) => (
<div key={appGroup.name}>
<AppGroup
dark={true}
group={appGroup}
onClick={(app, e) => {
if (app.isDisabled) {
e.preventDefault();
return;
}
dispatchEvent(
{
name: 'onAppNavigation',
},

{
appKey: app.key,
isFavorite: app.isPinned,
source: 'app-menu',
<>
<AppContextMessage />
<Styles.Wrapper>
{appGroups &&
appGroups.sort(appGroupArraySort).map((appGroup) => (
<div key={appGroup.name}>
<AppGroup
dark={true}
group={appGroup}
onClick={(app, e) => {
if (app.isDisabled) {
e.preventDefault();
return;
}
);
}}
onFavorite={(app) => addFavorite(app.key)}
/>
</div>
))}
</Styles.Wrapper>
dispatchEvent(
{
name: 'onAppNavigation',
},

{
appKey: app.key,
isFavorite: app.isPinned,
source: 'app-menu',
}
);
}}
onFavorite={(app) => addFavorite(app.key)}
/>
</div>
))}
</Styles.Wrapper>
</>
);
};
3 changes: 3 additions & 0 deletions client/packages/ui/src/components/message/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export const Styled = {
margin-inline-start: 0px;
margin-inline-end: 0px;
padding-inline-start: 35px;
& > li {
padding-bottom: 0.5rem;
}
`,
};

Expand Down

0 comments on commit 8e10993

Please sign in to comment.