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

Dev #1252

Merged
merged 2 commits into from
May 1, 2023
Merged

Dev #1252

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
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
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"type": "module",
"dependencies": {
"@betarena/scores-lib": "^0.10.18",
"@betarena/scores-lib": "^0.11.1",
"@lukeed/uuid": "^2.0.1",
"@metamask/sdk": "^0.1.0",
"@moralisweb3/client-firebase-auth-utils": "^2.18.4",
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