Skip to content

Commit

Permalink
Merge pull request #99 from virtualidentityag/staging-2024-04-25
Browse files Browse the repository at this point in the history
Staging 2024 04 25
  • Loading branch information
Leandro13Silva13 authored Apr 25, 2024
2 parents 45bd4b8 + 93a0c12 commit 1247194
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/components/localeSwitch/LocaleSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const LocaleSwitch: React.FC<LocaleSwitchProp> = ({
height={iconSize}
className="navigation__icon__filled"
color="inherit"
style={{ width: 'auto', height: 'auto' }}
/>
</>
)}{' '}
Expand Down
4 changes: 4 additions & 0 deletions src/components/localeSwitch/localeSwitch.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@
font-weight: $font-weight-medium;
}
}

.select__input__menu-portal {
z-index: 1000;
}
}
15 changes: 4 additions & 11 deletions src/components/sessionsListItem/SessionListItemComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export const SessionListItemComponent = ({
ALIAS_MESSAGE_TYPES.MASTER_KEY_LOST
);
const [plainTextLastMessage, setPlainTextLastMessage] = useState(null);
const topicSession = activeSession.item?.topic as TopicSessionInterface;

const { autoSelectPostcode } =
consultingType?.registration ||
Expand Down Expand Up @@ -348,10 +347,6 @@ export const SessionListItemComponent = ({
sessionTopic = activeSession.user.username;
}

const showConsultingType =
consultingType && !tenantData?.settings?.featureTopicsEnabled;
const zipCodeSlash = showConsultingType ? '/ ' : '';

return (
<div
onClick={handleOnClick}
Expand Down Expand Up @@ -384,24 +379,22 @@ export const SessionListItemComponent = ({
</div>
) : (
<div className="sessionsListItem__consultingType">
{topic?.name ? `${topic.name} ` : ''}
{activeSession.item.consultingType !== 1 &&
!isAsker &&
{!isAsker &&
!activeSession.isLive &&
!autoSelectPostcode
? zipCodeSlash + activeSession.item.postcode
? activeSession.item.postcode
: null}
</div>
)}
{topicSession?.id !== undefined && topicSession.name && (
{topic?.name && (
<div
className="sessionsListItem__topic"
style={{
backgroundColor:
tenantData?.theming?.primaryColor
}}
>
{topicSession?.name}
{topic.name}
</div>
)}
<div className="sessionsListItem__date">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}

.template {
width: 100%;
max-width: 700px;

h2,
Expand Down
19 changes: 16 additions & 3 deletions src/extensions/components/registration/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import {
registrationSessionStorageKey,
RegistrationData,
NotificationsContext,
NOTIFICATION_TYPE_ERROR
NOTIFICATION_TYPE_ERROR,
LocaleContext
} from '../../../globalState';
import { GlobalComponentContext } from '../../../globalState/provider/GlobalComponentContext';
import {
Expand Down Expand Up @@ -83,6 +84,7 @@ export const Registration = () => {
} = useContext(RegistrationContext);
const { consultant: preselectedConsultant } = useContext(UrlParamsContext);
const { tenant } = useContext(TenantContext);
const { locale } = useContext(LocaleContext);

const [stepData, setStepData] = useState<Partial<RegistrationData>>({});
const [redirectOverlayActive, setRedirectOverlayActive] =
Expand Down Expand Up @@ -185,7 +187,7 @@ export const Registration = () => {
agencyId: registrationData.agency.id.toString(),
postcode: registrationData.zipcode,
termsAccepted: 'true',
preferredLanguage: 'de',
preferredLanguage: locale || 'de',
consultingType: registrationData.agency.consultingType,
...(preselectedConsultant
? { consultantId: preselectedConsultant?.consultantId }
Expand Down Expand Up @@ -222,7 +224,8 @@ export const Registration = () => {
settings.multitenancyWithSingleDomainEnabled,
tenant,
addNotification,
t
t,
locale
]);

const stepPaths = useMemo(
Expand Down Expand Up @@ -356,6 +359,11 @@ export const Registration = () => {
disabled={disabledNextButton}
variant="contained"
onClick={onRegisterClick}
type={
disabledNextButton
? 'button'
: 'submit'
}
>
{t('registration.register')}
</Button>
Expand All @@ -366,6 +374,11 @@ export const Registration = () => {
variant="contained"
onClick={onNextClick}
sx={{ width: 'unset' }}
type={
disabledNextButton
? 'button'
: 'submit'
}
>
{t('registration.next')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export const AccountData: VFC<{
}
onInputChange={setRepeatPassword}
value={repeatPassword}
info="&nbsp;"
label={t('registration.account.repeatPassword.label')}
isValueValid={async (val) =>
val === password && password.length > 0
Expand All @@ -209,7 +210,7 @@ export const AccountData: VFC<{
'registration.account.repeatPassword.success'
)}
/>
<FormGroup sx={{ mt: '40px' }}>
<FormGroup sx={{ mt: '20px' }}>
<FormControlLabel
onClick={() => {
setDataProtectionChecked(!dataProtectionChecked);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ export const AgencySelectionResults = ({
const { setDisabledNextButton, registrationData } =
useContext(RegistrationContext);
const { consultant: preselectedConsultant } = useContext(UrlParamsContext);

const [selectedAgency, setSelectedAgency] = useState<AgencyDataInterface>(
registrationData?.agency
);

const onlyExternalAgencies = results?.every((agency) => agency.external);
const isSingleResultAndNotOnlyExternal =
results?.length === 1 && !onlyExternalAgencies;

useEffect(() => {
if (
// only external agencies
Expand All @@ -81,11 +84,7 @@ export const AgencySelectionResults = ({
return;
}

if (
// invalid agencyId, needs to be removed
selectedAgency &&
results?.length === 0
) {
if (results?.length === 0) {
setDisabledNextButton(true);
onChange({
agency: undefined
Expand All @@ -104,8 +103,6 @@ export const AgencySelectionResults = ({
}
}, [selectedAgency, results, onChange, setDisabledNextButton, zipcode]);

const onlyExternalAgencies = results?.every((agency) => agency.external);

return (
<>
{!!results && !preselectedConsultant && (
Expand Down Expand Up @@ -217,7 +214,7 @@ export const AgencySelectionResults = ({
)}

{/* one Result */}
{results?.length === 1 && !onlyExternalAgencies && (
{isSingleResultAndNotOnlyExternal && (
<FormControl sx={{ width: '100%' }}>
<RadioGroup
data-cy="agency-selection-radio-group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ const TopicSelect = ({
value={topic?.id}
control={
<Radio
tabIndex={0}
onClick={onChange}
checked={checked}
checkedIcon={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ export const ZipcodeInput: VFC<{
useEffect(() => {
if (REGISTRATION_DATA_VALIDATION.zipcode.validation(value)) {
setDisabledNextButton(false);
onChange({ zipcode: value });
onChange({
zipcode: value,
agencyId: undefined,
agency: undefined
});
} else {
setDisabledNextButton(true);
}
Expand Down
4 changes: 3 additions & 1 deletion src/globalState/provider/LocaleProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export function LocaleProvider(props) {
const [initLocale, setInitLocale] = useState(null);
const { informal } = useContext(InformalContext);
const [locales, setLocales] = useState([]);
const [locale, setLocale] = useState(null);
const [locale, setLocale] = useState(
localStorage.getItem(STORAGE_KEY_LOCALE) || null
);

useEffect(() => {
// If using the tenant service we should load first the tenant because we need the
Expand Down
5 changes: 4 additions & 1 deletion src/globalState/provider/RegistrationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) {

const { url } = useRouteMatch();

const [loading, setLoading] = useState<boolean>(true);
const [disabledNextButton, setDisabledNextButton] = useState<boolean>(true);
const [hasTopicError, setHasTopicError] = useState<boolean>(false);
const [hasAgencyError, setHasAgencyError] = useState<boolean>(false);
Expand Down Expand Up @@ -144,6 +145,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) {
(async () => {
const registrationData =
getSessionStorageData() as RegistrationData;

if (registrationData.mainTopicId) {
registrationData.mainTopic = await apiGetTopicById(
registrationData.mainTopicId
Expand All @@ -161,6 +163,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) {
);
}
setRegistrationData(registrationData);
setLoading(false);
})();
}, []);

Expand Down Expand Up @@ -250,7 +253,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) {
]
);

if (!loaded) return null;
if (!loaded || loading) return null;

return (
<RegistrationContext.Provider value={context}>
Expand Down

0 comments on commit 1247194

Please sign in to comment.