Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
RushanNanayakkara committed Jun 28, 2024
1 parent 275609d commit 3412baf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2021-2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
BrandingPreferenceInterface,
PreviewScreenType,
PreviewScreenVariationType
} from "@wso2is/common.branding.v1/models";
} from "@wso2is/common.branding.v1/models";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, {
FunctionComponent,
Expand All @@ -30,11 +30,9 @@ import BasicAuthFragment from "./fragments/basic-auth-fragment";
import CommonFragment from "./fragments/common-fragment";
import EmailLinkExpiryFragment from "./fragments/email-link-expiry-fragment";
import EmailOTPFragment from "./fragments/email-otp-fragment";
import {
PasswordRecoveryEmailLinkFragment,
PasswordRecoveryMultiOptionFragment,
PasswordRecoverySMSFragment
} from "./fragments/password-recovery";
import PasswordRecoveryEmailLinkFragment from "./fragments/password-recovery/password-recovery-email-link-fragment";
import PasswordRecoveryMultiOptionFragment from "./fragments/password-recovery/password-recovery-multi-option-fragment";
import PasswordRecoverySMSFragment from "./fragments/password-recovery/password-recovery-sms-otp-fragment";
import PasswordResetFragment from "./fragments/password-reset-fragment";
import PasswordResetSuccessFragment from "./fragments/password-reset-success-fragment";
import SignUpFragment from "./fragments/sign-up-fragment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
* under the License.
*/

import { PreviewScreenType, PreviewScreenVariationType } from "@wso2is/common.branding.v1/models";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { DropdownProps, Form, Select } from "semantic-ui-react";
import useBrandingPreference from "../hooks/use-branding-preference";
import { PreviewScreenType, PreviewScreenVariationType } from "../models/branding-preferences";
import { BASE_DISPLAY_VARIATION } from "../models/custom-text-preference";

/**
Expand Down
27 changes: 14 additions & 13 deletions features/admin.branding.v1/models/custom-text-preference.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
Expand All @@ -20,7 +20,7 @@ import {
BrandingPreferenceTypes,
PreviewScreenType,
PreviewScreenVariationType
} from "@wso2is/common.branding.v1/models";
} from "@wso2is/common.branding.v1/models";

/**
* Interface for the custom text preference API response.
Expand Down Expand Up @@ -115,15 +115,16 @@ export interface CustomTextPreferenceScreenMetaInterface {
* Base variations for screens. Represents the basic state of the screen.
*/
export const BASE_DISPLAY_VARIATION :Record<PreviewScreenType, PreviewScreenVariationType> = {
"common" : PreviewScreenVariationType.BASE,
"email-otp" : PreviewScreenVariationType.BASE,
"email-template" : PreviewScreenVariationType.BASE,
"login" : PreviewScreenVariationType.BASE,
"myaccount" : PreviewScreenVariationType.BASE,
"password-recovery" : PreviewScreenVariationType.EMAIL_LINK,
"password-reset" : PreviewScreenVariationType.BASE,
"password-reset-success" : PreviewScreenVariationType.BASE,
"sign-up" : PreviewScreenVariationType.BASE,
"sms-otp" : PreviewScreenVariationType.BASE,
"totp" : PreviewScreenVariationType.BASE
[PreviewScreenType.COMMON]: PreviewScreenVariationType.BASE,
[PreviewScreenType.EMAIL_OTP]: PreviewScreenVariationType.BASE,
[PreviewScreenType.EMAIL_TEMPLATE]: PreviewScreenVariationType.BASE,
[PreviewScreenType.LOGIN]: PreviewScreenVariationType.BASE,
[PreviewScreenType.MY_ACCOUNT]: PreviewScreenVariationType.BASE,
[PreviewScreenType.PASSWORD_RECOVERY]: PreviewScreenVariationType.EMAIL_LINK,
[PreviewScreenType.PASSWORD_RESET]: PreviewScreenVariationType.BASE,
[PreviewScreenType.PASSWORD_RESET_SUCCESS]: PreviewScreenVariationType.BASE,
[PreviewScreenType.SIGN_UP]: PreviewScreenVariationType.BASE,
[PreviewScreenType.SMS_OTP]: PreviewScreenVariationType.BASE,
[PreviewScreenType.TOTP]: PreviewScreenVariationType.BASE,
[PreviewScreenType.EMAIL_LINK_EXPIRY]: PreviewScreenVariationType.BASE
};

0 comments on commit 3412baf

Please sign in to comment.