Skip to content

Commit

Permalink
Feature/issue 1231/seo platform speed ehance (#1248)
Browse files Browse the repository at this point in the history
* issue: #1231; revert vite.config.js plugins;

* chore: update/template.svelte;

* doc: app.html scripts update; aesthetics;

* feature: create widget no data component to reuse;

* feature: #1231: speed improvement;

* chore: aesthetic + comments add;

* fix: deepsource issues;
  • Loading branch information
migbash authored Apr 29, 2023
1 parent 74ed828 commit c26cd5d
Show file tree
Hide file tree
Showing 73 changed files with 720 additions and 810 deletions.
19 changes: 0 additions & 19 deletions CONTRIBUTING/TEMPLATE.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,9 @@ COMPONENT JS (w/ TS)
//#region ➤ [MAIN] Package Imports
// <-imports-go-here->
//#region ➤ Svelte/SvelteKit Imports
// <-imports-go-here->
import { onMount } from 'svelte';
//#endregion ➤ Svelte/SvelteKit Imports
//#region ➤ Project Custom Imports
// <-imports-go-here->
import { viewport_change } from '$lib/utils/platform-functions';
//#endregion ➤ Project Custom Imports
//#region ➤ [PLUGIN] Firebase Imports
// <-imports-go-here->
//#endregion ➤ [PLUGIN] Firebase Imports
//#region ➤ Types Imports
// <-imports-go-here->
//#endregion ➤ Types Imports
//#region ➤ Assets Imports
// <-imports-go-here->
import profile_avatar from './assets/profile-avatar.svg';
//#endregion ➤ Assets Imports
//#endregion ➤ [MAIN] Package Imports
Expand Down
19 changes: 12 additions & 7 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes"
content="
width=device-width,
initial-scale=1.0,
user-scalable=yes
"
/>
<meta name="theme-color" content="#292929" />
<link
Expand Down Expand Up @@ -96,11 +100,12 @@
<!--
[ℹ] ANALYTICS TAGS
<-contents->
[ℹ] YANDEX - ORIGINAL
[ℹ] GOOGLE V1 - ORIGINAL
[ℹ] GOOGLE V2 - NONCE BASED
[ℹ] 1. SMARTLOOK
[ℹ] 2. GOOGLE ANALYTICS
-->
<script type="text/javascript">
<script
type="text/javascript"
>
window.smartlook ||
(function (d) {
var o = (smartlook = function () {
Expand All @@ -126,7 +131,8 @@
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-60160331-9"
></script>
>
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
Expand All @@ -135,7 +141,6 @@
gtag('js', new Date());
gtag('config', 'UA-60160331-9');
</script>

%sveltekit.head%
</head>
<body
Expand Down
10 changes: 6 additions & 4 deletions src/lib/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export async function get(
// curcanavigate CORS issues
// endpoint = 'https://cors-anywhere.herokuapp.com/' + endpoint // comment this out before subemission,
// ...
return await fetch(endpoint, {
const response = await fetch(endpoint, {
method: 'GET'
}).then((response) => {
// ... verify if the response is error-free
if (!response.ok) {
if (dev)
logErrorGroup(
'utils [DEV]',
`response: ${response}`
`response: ${JSON.stringify(response)}`
);
throw new Error(
'Network response was not ok'
Expand All @@ -34,6 +34,7 @@ export async function get(
// ... return the data
return response.json();
});
return response;
}

/**
Expand All @@ -54,7 +55,7 @@ export async function post(
data
): Promise<unknown> {
// ...
return await fetch(path, {
const response = await fetch(path, {
method: 'POST',
credentials: 'include',
body: JSON.stringify(data),
Expand All @@ -69,7 +70,7 @@ export async function post(
if (dev)
logErrorGroup(
'utils [DEV]',
`response: ${response}`
`response: ${JSON.stringify(response)}`
);
throw new Error(
'Network response was not ok'
Expand All @@ -78,4 +79,5 @@ export async function post(
// ... return the data
return response.json();
});
return response;
}
197 changes: 197 additions & 0 deletions src/lib/components/Widget-No-Data.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
<!--
====================
This is an example .svelte
component file, to give guidance on
the structure that is employed across the project
and how it should be layed-out.
====================
<COPY-THIS-FILE-INTO-YOUR-NEXT-COMPONENT>
====================
<❗️ REMOVE (THIS) COMMENT IN PRODUCTION>
-->

<!-- ===============
COMPONENT JS (w/ TS)
=================-->

<script lang="ts">
//#region ➤ [MAIN] Package Imports
// <-imports-go-here->
import { userBetarenaSettings } from '$lib/store/user-settings.js';
import { viewport_change } from '$lib/utils/platform-functions';
import { onMount } from 'svelte';
import WidgetTitle from './Widget-Title.svelte';
//#endregion ➤ [MAIN] Package Imports
//#region ➤ [VARIABLES]
// ~~~~~~~~~~~~~~~~~~~~~
// COMPONENT VARIABLES
// ~~~~~~~~~~~~~~~~~~~~~
export let WIDGET_TITLE: string
export let NO_DATA_TITLE: string
export let NO_DATA_DESC: string
//#endregion ➤ [VARIABLES]
//#region ➤ [MAIN-METHODS]
// ~~~~~~~~~~~~~~~~~~~~~
// COMPONENT METHODS
// ~~~~~~~~~~~~~~~~~~~~~
function do_something() {}
// ~~~~~~~~~~~~~~~~~~~~~
// VIEWPORT CHANGES | IMPORTANT
// ~~~~~~~~~~~~~~~~~~~~~
const TABLET_VIEW = 1160;
const MOBILE_VIEW = 475;
let mobileExclusive, tabletExclusive: boolean = false;
onMount(async () => {
[tabletExclusive, mobileExclusive] =
viewport_change(TABLET_VIEW, MOBILE_VIEW);
window.addEventListener(
'resize',
function () {
[tabletExclusive, mobileExclusive] =
viewport_change(
TABLET_VIEW,
MOBILE_VIEW
);
}
);
});
//#endregion ➤ [METHODS]
//#region ➤ [ONE-OFF] [METHODS] [HELPER] [IF]
//#endregion ➤ [ONE-OFF] [METHODS] [IF]
//#region ➤ [REACTIVIY] [METHODS]
//#endregion ➤ [REACTIVIY] [METHODS]
//#region ➤ SvelteJS/SvelteKit [LIFECYCLE]
//#endregion ➤ SvelteJS/SvelteKit [LIFECYCLE]
</script>

<!-- ===================
SVELTE INJECTION TAGS
=================== -->

<svelte:head>
<!-- <add> -->
</svelte:head>

<!-- ===============
COMPONENT HTML
NOTE: [HINT] use (CTRL+SPACE) to select a (class) (id) style
=================-->

<!--
[ℹ] title of the widget
-->
<WidgetTitle
{WIDGET_TITLE}
OVERRIDE_COLOR={true}
/>

<!--
[ℹ] no-matches-avaiable-placeholder container
-->
<div
class="
no-widget-box
row-space-start
"
class:dark-background-1={$userBetarenaSettings.theme == 'Dark'}
>
<!--
[ℹ] no-matches-visual
-->
<img
src={
$userBetarenaSettings.theme == 'Dark'
? '/assets/svg/noWidgetDataDark.svg'
: '/assets/svg/noWidgetData.svg'
}
alt="No widget visual icon"
width="80"
height="80"
class="m-r-20"
/>
<!--
[ℹ] container w/ text
-->
<div>
<p
class="
s-16
m-b-8
w-500
"
>
{NO_DATA_TITLE}
</p>
<p
class="
s-16
color-grey
w-400
"
>
{NO_DATA_DESC}
</p>
</div>
</div>

<!-- ===============
COMPONENT STYLE
NOTE: [HINT] auto-fill/auto-complete iniside <style> for var() values by typing/(CTRL+SPACE)
=================-->

<style>
/* #region ❌ [NOT WORKING] w/ regions */
/* div#example {
color: var(--dark-theme);
background-color: var();
} div#example > div#target {
} */
/* #endregion ❌ [NOT WORKING] w/ regions */
.no-widget-box {
padding: 20px;
background: #ffffff;
box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.08);
border-radius: 12px;
}
/*
=============
RESPONSIVNESS
=============
*/
@media only screen
and (min-width: 726px)
and (max-width: 1000px) {
}
/*
=============
DARK-THEME
=============
*/
</style>
Loading

0 comments on commit c26cd5d

Please sign in to comment.