Skip to content

Commit

Permalink
dev-to-prod (#2195)
Browse files Browse the repository at this point in the history
* dev: hide intercom (#2190)

* Feature/header redesign/draft/1 (#2191)

* fix: Content section header border

* fix: competition modal

* dev: hide breadcrumbs in PWA

* dev revert unnessery changes

* dev: reemove debugger

* fix: IsPwa ssr (#2194)
  • Loading branch information
Izobov authored Jun 18, 2024
1 parent f80aa26 commit 3b8b623
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
</SeoBox>

<header
id="header"
class:mobile
class:dark-mode={currentPageRouteId !== "AuthorsPage"}
style:border-bottom={$page.route.id === routeIdPageAuthors
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/misc/modal/ModalMain.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<ModalBackdrop on:closeModal={() => ($modalStore.show = false)} />
{/if}
<div class="modal-content">
<svelte:component this={$modalStore.component} />
<svelte:component this={$modalStore.component} {...$modalStore.props} />
</div>
{/if}

Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/page/competition/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@
id="page-competitions"
>

<Breadcrumb />
{#if !$sessionStore.globalState.has("IsPWA")}
<Breadcrumb />
{/if}

<div
class=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
/** @description competition (main) - view type */
viewType: 'confirm' | 'insufficient' | 'geo-restriction' | 'not-authenticated',
/** @description competition (main) - amount entry fee */
balanceDeductAmount: number
balanceDeductAmount: number,
on: any
;
const
Expand All @@ -72,6 +73,7 @@
(
): void
{
on.closeModal();
dispatch('closeModal');
}
Expand All @@ -86,6 +88,7 @@
(
): void
{
on.confirmEntry();
dispatch('confirmEntry');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import type { BetarenaUser } from '@betarena/scores-lib/types/_FIREBASE_.js';
import type { B_C_COMP_DATA_Prediction_Group, B_C_COMP_DATA_Status } from '@betarena/scores-lib/types/_HASURA_.js';
import type { B_COMP_MAIN_T } from '@betarena/scores-lib/types/types.competition.main.js';
import { modalStore } from '$lib/store/modal.js';
// #endregion ➤ 📦 Package Imports
Expand Down Expand Up @@ -129,6 +130,7 @@
// ### [🐞]
// alert('Joining Competition');
await get
(
`/api/data/competition/main?competition_id=${$page.data?.COMPETITION_ID}&participantUid=${$userBetarenaSettings?.user?.firebase_user_data?.uid}&predictionChoice=${viewType}`
Expand Down Expand Up @@ -229,6 +231,22 @@
adjustParticipantListUser();
}
function showModalHandler() {
$modalStore.component = MainModalMultiple;
$modalStore.props = {
isViewMobile,
isViewTablet,
viewType: modalViewType,
balanceDeductAmount: entryFee,
on: {
closeModal: () => $modalStore.show = false,
confirmEntry: () => joinCompetition(),
}
};
$modalStore.show = true;
$modalStore.modal = false;
}
// #endregion ➤ 🔥 REACTIVIY [SVELTE]
// #region ➤ 🔄 LIFECYCLE [SVELTE]
Expand Down Expand Up @@ -281,19 +299,7 @@
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
-->

<!--
MORE INFORMATION / ALERT MODAL
-->
{#if showModal}
<MainModalMultiple
{isViewMobile}
{isViewTablet}
viewType={modalViewType}
balanceDeductAmount={entryFee}
on:closeModal={() => showModal = false}
on:confirmEntry={() => joinCompetition()}
/>
{/if}


<!--
PARTICIPANTS VOTE LIST
Expand Down Expand Up @@ -445,7 +451,7 @@ PARTICIPANTS VOTE LIST
w-500
btn-primary-v2
"
on:click={() => showModal = true}
on:click={showModalHandler}
class:disabled={isJoinedNotThis || competitionStatus != 'pending' || disabledJoinBtn}
class:color-grey={isJoinedNotThis || competitionStatus != 'pending' || disabledJoinBtn}
disabled={isJoinedNotThis || competitionStatus != 'pending' || disabledJoinBtn}
Expand Down
14 changes: 8 additions & 6 deletions src/lib/components/page/fixture/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,14 @@ NOTE: [HINT] use (CTRL+SPACE) to select a (class) (id) style

<section
id="fixture-page">

<Breadcrumb
{FIXTURE_INFO}
{country_link}
{league_name_link}
/>
{#if !$sessionStore.globalState.has("IsPWA")}
<!-- content here -->
<Breadcrumb
{FIXTURE_INFO}
{country_link}
{league_name_link}
/>
{/if}

<!--
FIXME: TODO: update to have a single dynamic layout
Expand Down
16 changes: 8 additions & 8 deletions src/lib/components/page/league/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import Breadcrumb from './Breadcrumb.svelte';
import FixtureOddsWidget from './fixture-odds/FixtureOdds-Widget.svelte';
// #endregion ➤ [MAIN] Package Imports
// #region ➤ [VARIABLES]
Expand Down Expand Up @@ -240,13 +240,13 @@
<section
id="tournaments-page"
>

<Breadcrumb
sportT={TOURNAMENT_DATA.sport}
countryT={TOURNAMENT_DATA.country}
leagueNameT={TOURNAMENT_DATA.name}
/>

{#if !$sessionStore.globalState.has("IsPWA")}
<Breadcrumb
sportT={TOURNAMENT_DATA.sport}
countryT={TOURNAMENT_DATA.country}
leagueNameT={TOURNAMENT_DATA.name}
/>
{/if}
{#if !tabletExclusive && !mobileExclusive}
<!-- <LeagueInfoWidget LEAGUE_INFO_SEO_DATA={LEAGUE_INFO_DATA} /> -->
<svelte:component
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/page/player/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ NOTE: [HINT] use (CTRL+SPACE) to select a (class) (id) style

<section
id="section-player-page">

<Breadcrumb />
{#if !$sessionStore.globalState.has("IsPWA")}
<Breadcrumb />
{/if}
<ProfileWidget/>

<!--
Expand Down
3 changes: 3 additions & 0 deletions src/lib/components/section/authors/page/content/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
:global
{
.mobile#header {
--header-border: none;
}
section#content
{
Expand Down
3 changes: 2 additions & 1 deletion src/lib/store/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface IModalStore
show: boolean;
modal: boolean;
component: SvelteComponent | null;
props?: any
}

export const modalStore: Writable<IModalStore> = writable({ show: false, modal: false, component: null });
export const modalStore: Writable<IModalStore> = writable({ show: false, modal: false, component: null, props: {} });
111 changes: 66 additions & 45 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@
});
}
$: if (browser) {
window.Intercom("update", {
hide_default_launcher: currentPageRouteId != "ProfilePage",
});
}
// #endregion ➤ 🔥 REACTIVIY [SVELTE]
// #region ➤ 🔄 LIFECYCLE [SVELTE]
Expand Down Expand Up @@ -362,7 +368,9 @@
}
// IMPORTANT
sessionStore.updateData([["windowWidth", document.documentElement.clientWidth]]);
sessionStore.updateData([
["windowWidth", document.documentElement.clientWidth],
]);
// IMPORTANT
if (isPWA()) $sessionStore.globalState.add("IsPWA");
else $sessionStore.globalState.delete("IsPWA");
Expand Down Expand Up @@ -400,8 +408,8 @@
<!--
HELPDESK PLUGIN
-->
{#if currentPageRouteId == "ProfilePage" || currentPageRouteId == "CompetitionPage"}
<!-- <script type="text/javascript">

<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -414,7 +422,7 @@
}
)();
</script> -->
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -427,7 +435,7 @@
}
)();
</script> -->
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -440,7 +448,7 @@
}
)();
</script> -->
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -453,7 +461,7 @@
}
)();
</script> -->
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -466,7 +474,7 @@
}
)();
</script> -->
<!-- <script type="text/javascript">
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
Expand All @@ -479,44 +487,55 @@
}
)();
</!-->
-->
<script>
// We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/yz9qn6p3'
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic("reattach_activator");
ic("update", w.intercomSettings);
<!-- <script type="text/javascript">
window.$crisp=[];
window.CRISP_WEBSITE_ID="cb59b31a-b48f-42d5-a24b-e4cf5bac0222";
(function()
{
d=document;
s=d.createElement("script");
s.src="https://client.crisp.chat/l.js";
s.async=1;
d.getElementsByTagName("head")[0].appendChild(s);
}
)();
</!-->
<script>
// We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/yz9qn6p3'
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic("reattach_activator");
ic("update", w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "https://widget.intercom.io/widget/yz9qn6p3";
var x = d.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === "complete") {
l();
} else if (w.attachEvent) {
w.attachEvent("onload", l);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "https://widget.intercom.io/widget/yz9qn6p3";
var x = d.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === "complete") {
l();
} else if (w.attachEvent) {
w.attachEvent("onload", l);
} else {
w.addEventListener("load", l, false);
}
w.addEventListener("load", l, false);
}
})();
</script>
{/if}
}
})();
</script>
</svelte:head>

<svelte:document
Expand All @@ -534,7 +553,9 @@

<svelte:window
on:resize={() => {
sessionStore.updateData([["windowWidth", document.documentElement.clientWidth]]);
sessionStore.updateData([
["windowWidth", document.documentElement.clientWidth],
]);
if (isPWA()) $sessionStore.globalState.add("IsPWA");
else $sessionStore.globalState.delete("IsPWA");
return;
Expand Down

0 comments on commit 3b8b623

Please sign in to comment.