Skip to content

Commit

Permalink
Merge pull request #253 from virtualidentityag/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Leandro13Silva13 authored Jan 29, 2025
2 parents 7f0593d + 2655554 commit 0f31465
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
branch: ${{env.BRANCH}}
force: true
tags: true
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dockerImage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
npm run test:build
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: buildfiles
path: build/**/*
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download buildfiles artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: buildfiles
path: build
Expand Down
11 changes: 4 additions & 7 deletions cypress/e2e/videoconference.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('videoconference', () => {
it('Start moderator video call', () => {
cy.get('@appointmentId').then((id: any) => {
const videoUrl = config.urls.consultantVideoConference
.replace('/:type', '/app')
.replace('/:type', '/overview')
.replace('/:appointmentId', `/${id}`);

cy.visit(videoUrl);
Expand All @@ -151,7 +151,7 @@ describe('videoconference', () => {

it('Start non existent moderator video call', () => {
const videoUrl = config.urls.consultantVideoConference
.replace('/:type', '/app')
.replace('/:type', '/overview')
.replace('/:appointmentId', `/${uuid()}`);

cy.visit(videoUrl);
Expand Down Expand Up @@ -248,10 +248,7 @@ describe('videoconference', () => {

cy.visit(videoUrl);

cy.url().should(
'contain',
'/sessions/consultant/sessionPreview'
);
cy.url().should('contain', '/overview');
});
});

Expand All @@ -262,7 +259,7 @@ describe('videoconference', () => {

cy.visit(videoUrl);

cy.url().should('contain', '/sessions/consultant/sessionPreview');
cy.url().should('contain', '/overview');
});
});

Expand Down
6 changes: 4 additions & 2 deletions cypress/support/commands/helper/fastLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ const fastLoginCommand = (getWillReturn, setWillReturn) =>
tomorrow.getTime().toString()
);

cy.visit('/app');
cy.wait('@usersData');
if (userId === USER_ASKER) {
cy.visit('/app');
cy.wait('@usersData');
cy.wait('@askerSessions');
} else {
cy.visit('/sessions/consultant/sessionPreview');
cy.wait('@usersData');
cy.wait('@consultantEnquiriesBase');
}
});
Expand Down
7 changes: 3 additions & 4 deletions src/components/app/Routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,9 @@ export const Routing = (props: RoutingProps) => {
<Redirect
from="*"
to={
'/sessions/' +
(hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)
? 'consultant/sessionPreview'
: 'user/view')
hasUserAuthority(AUTHORITIES.CONSULTANT_DEFAULT, userData)
? '/overview'
: '/sessions/user/view'
}
/>
</Switch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
convertToRaw,
DraftHandleValue,
EditorState,
getDefaultKeyBinding,
RichUtils
} from 'draft-js';
import { draftToMarkdown } from 'markdown-draft-js';
Expand Down Expand Up @@ -404,17 +405,12 @@ export const MessageSubmitInterfaceComponent = ({
]
);

const handleEditorKeyCommand = useCallback(
(command) => {
const newState = RichUtils.handleKeyCommand(editorState, command);
if (newState) {
handleEditorChange(newState);
return 'handled';
}
return 'not-handled';
},
[editorState, handleEditorChange]
);
const handleCustomKeyBinding = (event) => {
if (event.key === 'Enter' && event.shiftKey) {
return 'shift-enter';
}
return getDefaultKeyBinding(event);
};

const resizeTextarea = useCallback(() => {
const textInput: any = textareaInputRef.current;
Expand Down Expand Up @@ -782,6 +778,23 @@ export const MessageSubmitInterfaceComponent = ({
userData
]);

const handleEditorKeyCommand = useCallback(
(command) => {
const newState = RichUtils.handleKeyCommand(editorState, command);
if (command === 'shift-enter') {
handleButtonClick();
return 'handled';
}

if (newState) {
handleEditorChange(newState);
return 'handled';
}
return 'not-handled';
},
[editorState, handleEditorChange, handleButtonClick]
);

const handleRequestFeedbackCheckbox = useCallback(() => {
setRequestFeedbackCheckboxChecked(
(requestFeedbackCheckboxChecked) => !requestFeedbackCheckboxChecked
Expand Down Expand Up @@ -1026,6 +1039,7 @@ export const MessageSubmitInterfaceComponent = ({
handleKeyCommand={
handleEditorKeyCommand
}
keyBindingFn={handleCustomKeyBinding}
placeholder={
hasRequestFeedbackCheckbox &&
requestFeedbackCheckboxChecked
Expand Down
28 changes: 28 additions & 0 deletions src/components/profile/ConsultantInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { EditableData } from '../editableData/EditableData';
import { apiPatchUserData } from '../../api/apiPatchUserData';
import { useTranslation } from 'react-i18next';
import { useAppConfig } from '../../hooks/useAppConfig';
import { Overlay, OVERLAY_FUNCTIONS, OverlayItem } from '../overlay/Overlay';
import { ReactComponent as CheckIcon } from '../../resources/img/illustrations/check.svg';

export const ConsultantInformation = () => {
const { t: translate } = useTranslation();
Expand All @@ -30,6 +32,7 @@ export const ConsultantInformation = () => {
const [isSaveDisabled, setIsSaveDisabled] = useState(false);
const [editedDisplayName, setEditedDisplayName] = useState('');
const [initialDisplayName, setInitialDisplayName] = useState('');
const [successOverlayActive, setSuccessOverlayActive] = useState(false);

const cancelEditButton: ButtonItem = {
label: translate('profile.data.edit.button.cancel'),
Expand All @@ -42,6 +45,18 @@ export const ConsultantInformation = () => {
type: BUTTON_TYPES.LINK
};

const overlayItem: OverlayItem = {
svg: CheckIcon,
headline: translate('profile.data.displayNameInfo'),
buttonSet: [
{
label: translate('profile.data.displayNameInfoClose'),
function: OVERLAY_FUNCTIONS.CLOSE,
type: BUTTON_TYPES.AUTO_CLOSE
}
]
};

const handleValidDisplayName = (displayName) => {
setEditedDisplayName(displayName);
};
Expand All @@ -55,6 +70,7 @@ export const ConsultantInformation = () => {
.then(() => {
reloadUserData().catch(console.log);
setInitialDisplayName(editedDisplayName);
setSuccessOverlayActive(true);
})
.catch((error) => {
addNotification({
Expand All @@ -71,6 +87,12 @@ export const ConsultantInformation = () => {
});
};

const handleSuccessOverlayAction = (buttonFunction: string) => {
if (buttonFunction === OVERLAY_FUNCTIONS.CLOSE) {
setSuccessOverlayActive(false);
}
};

useEffect(() => {
if (editedDisplayName) {
setIsSaveDisabled(false);
Expand Down Expand Up @@ -140,6 +162,12 @@ export const ConsultantInformation = () => {
/>
</div>
)}
{successOverlayActive && (
<Overlay
item={overlayItem}
handleOverlay={handleSuccessOverlayAction}
/>
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ $iconSize: 32px;
margin-top: $grid-base;
color: $text-low-emphasis;
}

&__customLink {
text-decoration: underline;
}
}
}
4 changes: 2 additions & 2 deletions src/components/serviceExplanation/ServiceExplanation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ export const ServiceExplanation = ({
],
{ ns: ['consultingTypes', 'common'] }
),
text: translate(
text: `${translate(
[
`consultingType.${consultingTypeId}.welcomeScreen.anonymous.text`,
`consultingType.fallback.welcomeScreen.anonymous.text`,
welcomeScreenConfig?.anonymous.text ||
'registration.welcomeScreen.info4.text'
],
{ ns: ['consultingTypes', 'common'] }
)
)} <a href="${translate('registration.welcomeScreen.info4.link')}" class="serviceExplanation__infoContent__customLink" target="_blank" rel="noreferrer">${translate('registration.welcomeScreen.info4.linkText')}</a>`
}
];

Expand Down
39 changes: 38 additions & 1 deletion src/components/sessionMenu/SessionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
SessionTypeContext,
useConsultingType,
UserDataContext,
ActiveSessionContext
ActiveSessionContext,
TenantContext
} from '../../globalState';
import {
SessionItemInterface,
Expand Down Expand Up @@ -69,6 +70,9 @@ import { useTranslation } from 'react-i18next';
import { LegalLinksContext } from '../../globalState/provider/LegalLinksProvider';
import { RocketChatUsersOfRoomContext } from '../../globalState/provider/RocketChatUsersOfRoomProvider';
import LegalLinks from '../legalLinks/LegalLinks';
import { endpoints } from '../../resources/scripts/endpoints';
import { refreshKeycloakAccessToken } from '../sessionCookie/refreshKeycloakAccessToken';
import { apiGetUserDataBySessionId } from '../../api/apiGetUserDataBySessionId';

type TReducedSessionItemInterface = Omit<
SessionItemInterface,
Expand Down Expand Up @@ -105,6 +109,9 @@ export const SessionMenu = (props: SessionMenuProps) => {
const [redirectToSessionsList, setRedirectToSessionsList] = useState(false);
const [isRequestInProgress, setIsRequestInProgress] = useState(false);

const { tenant } = useContext(TenantContext);
const [askerItemId, setAskerItemId] = useState<string>();

const sessionListTab = useSearchParam<SESSION_LIST_TAB>('sessionListTab');
const getSessionListTab = () =>
`${sessionListTab ? `?sessionListTab=${sessionListTab}` : ''}`;
Expand Down Expand Up @@ -327,6 +334,25 @@ export const SessionMenu = (props: SessionMenuProps) => {
subRoute: 'userProfile'
});

const openToolsLink = () => {
refreshKeycloakAccessToken().then((resp) => {
const accessToken = resp.access_token;
window.open(
`${endpoints.budibaseTools(
activeSession.consultant.id
)}/consultantview?userId=${askerItemId}&access_token=${accessToken}`,
'_blank',
'noopener'
);
});
};

useEffect(() => {
apiGetUserDataBySessionId(activeSession.item.id).then((resp) => {
setAskerItemId(resp.askerId);
});
}, [activeSession?.item?.id, askerItemId]); // eslint-disable-line react-hooks/exhaustive-deps

if (redirectToSessionsList) {
mobileListView();
return <Redirect to={listPath + getSessionListTab()} />;
Expand Down Expand Up @@ -543,6 +569,17 @@ export const SessionMenu = (props: SessionMenuProps) => {
</Link>
)}

{!hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) &&
tenant?.settings?.featureToolsEnabled &&
activeSession?.item.id && (
<div
className="sessionMenu__item"
onClick={() => openToolsLink()}
>
{translate('chatFlyout.toolsDocumentation')}
</div>
)}

{!hasUserAuthority(AUTHORITIES.ASKER_DEFAULT, userData) &&
type !== SESSION_LIST_TYPES.ENQUIRY &&
activeSession.isSession &&
Expand Down
2 changes: 1 addition & 1 deletion src/containers/bookings/components/Calcom/Cal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function Cal({
action: 'bookingSuccessful',
callback: () => {
history.push({
pathname: `/sessions/user/view`
pathname: `/booking/events/gebuchte`
});
}
});
Expand Down
14 changes: 7 additions & 7 deletions src/extensions/resources/i18n/overwrites/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,18 @@
"overline": "Herzlich willkommen!",
"welcomeScreen": {
"info1": {
"text": "Finden Sie eine passende Beratungsstelle"
"text": "Finden Sie eine passende Beratungsstelle."
},
"info2": {
"title": "Nehmen Sie Kontakt auf",
"text": "Schreiben Sie eine Nachricht oder vereinbaren Sie einen Termin"
"text": "Schreiben Sie eine Nachricht oder vereinbaren Sie einen Termin."
},
"subline": "So funktioniert die Beratung auf der DigiSucht Plattform:",
"info3": {
"text": "Je nach Verfügbarkeit per Nachricht, im Textchat, im Videochat oder vor Ort"
"text": "Je nach Verfügbarkeit per Nachricht, im Textchat, im Videochat oder vor Ort."
},
"info4": {
"text": "Sie bleiben auf Wunsch anonym und werden kostenfrei beraten"
"text": "Sie bleiben auf Wunsch anonym und werden kostenfrei beraten."
}
},
"overlay": {
Expand Down Expand Up @@ -198,14 +198,14 @@
"username.step.title": "Bitte wählen Sie Ihren Benutzernamen",
"welcomeScreen": {
"info1": {
"text": "Finden Sie eine passende Beratungsstelle"
"text": "Finden Sie eine passende Beratungsstelle."
},
"info2": {
"title": "Nehmen Sie Kontakt auf",
"text": "Schreiben Sie eine Nachricht oder vereinbaren Sie einen Termin"
"text": "Schreiben Sie eine Nachricht oder vereinbaren Sie einen Termin."
},
"info4": {
"text": "Schreiben Sie eine Nachricht oder vereinbaren Sie einen Termin"
"text": "Sie bleiben auf Wunsch anonym und werden kostenfrei beraten."
}
},
"overlay": {
Expand Down
Loading

0 comments on commit 0f31465

Please sign in to comment.