Skip to content

Commit

Permalink
✨ feat: show download banner using query params (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
rezk2ll authored May 27, 2024
1 parent ce745b5 commit ee90d55
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion registration/src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ interface SessionData {
recovery_otp_request_token?: string;
verified_recovery_phone?: boolean;
recovery_step?: PasswordRecoveryStepType = 'phone';
simpleRedirect?: boolean = false;
simpleRedirect?: boolean = false;
banner?: boolean = false;
}
13 changes: 6 additions & 7 deletions registration/src/routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const load: PageServerLoad = async ({ locals, url, cookies, request, getC
const app = (url.searchParams.get('app') as ApplicationType) ?? 'default';
const willLogin = url.searchParams.get('login') !== null;
const simpleRedirect = url.searchParams.get('simple_redirect') !== null;
const banner = url.searchParams.get('banner') !== null;

const cookie = cookies.get(authService.cookieName);

Expand All @@ -39,7 +40,8 @@ export const load: PageServerLoad = async ({ locals, url, cookies, request, getC
postLoginUrl,
country,
app,
simpleRedirect
simpleRedirect,
banner
}));

logger.info('detected context: ', {
Expand Down Expand Up @@ -71,7 +73,8 @@ export const load: PageServerLoad = async ({ locals, url, cookies, request, getC
isLogin: isLogin || willLogin,
step: session.data.step || initialStep,
verified: session.data.verified,
phone: session.data.phone
phone: session.data.phone,
banner
};
};

Expand Down Expand Up @@ -385,11 +388,7 @@ export const actions: Actions = {
};

const { login, password } = data;
const {
postLoginUrl = null,
simpleRedirect,
app
} = session.data;
const { postLoginUrl = null, simpleRedirect, app } = session.data;

if (!login || !password) {
logger.error('Missing login or password');
Expand Down
4 changes: 3 additions & 1 deletion registration/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
userCountry,
registrationStep,
verified,
phone
phone,
showBanner
} from '$store';
import AccessSelect from '$components/landing/AccessSelect.svelte';
import Hero from '$components/landing/Hero.svelte';
Expand All @@ -24,6 +25,7 @@
$: registrationStep.set(data.step);
$: verified.set(data.verified);
$: phone.set(data.phone ?? '');
$: showBanner.set(data.banner);
</script>

<div class="flex w-full h-full lg:px-10 xl:px-[148px] 2xl:px-52 3xl:px-72 4xl:px-96">
Expand Down
2 changes: 1 addition & 1 deletion registration/src/store/banner.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { writable } from 'svelte/store';

export const showBanner = writable<boolean>(true);
export const showBanner = writable<boolean>(false);

0 comments on commit ee90d55

Please sign in to comment.