Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ show download banner using query params #216

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Loading