Skip to content

Commit

Permalink
MWPW-164734 - single rollout for loc
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhsircar11 committed Jan 7, 2025
1 parent 562a202 commit 2355617
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions libs/blocks/locui-create/input-locale/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function InputLocales() {
} = useInputLocale();

const RenderRegion = () => {
if (!initByParams.value.languages) {
if (!initByParams.value?.languages) {
return (html`
<h5 class="section-header">Quick Select for Language/Locale</h5>
<div class="region-grid">
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function InputLocales() {
};

const RenderLanguage = () => {
if (!initByParams.value.languages) {
if (!initByParams.value?.languages) {
return (html`
<div class="language-grid">
<h5 class="section-header">Select the Language(s)</h5>
Expand Down
4 changes: 2 additions & 2 deletions libs/blocks/locui-create/input-urls/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default function InputUrls() {
<span>- ${PROJECT_TYPE_LABELS[type]}</span>
</div>
<div class="locui-form-body">
${(!projectCreated.value && !initByParams.value.type) && html`
${(!projectCreated.value && !initByParams.value?.type) && html`
<div class="segment-ctrl pb-12">
${[PROJECT_TYPES.translation, PROJECT_TYPES.rollout].map((pType) => html`
<div
Expand Down Expand Up @@ -288,7 +288,7 @@ export default function InputUrls() {
onInput=${handleUrlsChange}
onBlur=${handleUrlsBlur}
placeholder=${`Enter the full URL. E.g, ${origin}/drafts/localization/projects/raga/image-test-one`}
disabled=${initByParams.value.urls}
disabled=${initByParams.value?.urls}
/>
${errors.urlsStr
&& html`<div class="form-field-error">${errors.urlsStr}</div>`}
Expand Down
3 changes: 2 additions & 1 deletion libs/blocks/locui-create/locui-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ function Create() {
});
setSelectedLocalesAndRegions();
}
} else {
}
if (projectInitByUrl && !projectKey) {
setProject(projectInitByUrl);
setInitByParams(projectInitByUrl);
setSelectedLocalesAndRegions();
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/locui-create/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const locales = signal([]);
export const localeRegion = signal([]);
export const locSelected = signal(null);
export const projectType = signal('rollout');
export const initByParams = signal({});
export const initByParams = signal(null);
export const env = signal('dev');

export function nextStep() {
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/locui-create/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,5 @@ export function getProjectByParams(searchParams) {
projectInfo.languages = getLanguageDetails(language);
}

return projectInfo;
return Object.keys(projectInfo).length > 0 ? projectInfo : null;
}

0 comments on commit 2355617

Please sign in to comment.