Skip to content

Commit

Permalink
feature/create-sportstack/2 (#2294)
Browse files Browse the repository at this point in the history
* feat: add no content message and eye-off icon to author widget

* fix: update @betarena/scores-lib to version 4.0.36 and add cross-env as a new dependency

* feat: add Google Cloud Translation integration and update article processing to identify language

* fix: update no articles message and adjust styling for author widget

* fix: update OpenGraph locale to use dynamic language variable

* fix: simplify sportstacks sorting logic in author widget

* fix: update @betarena/scores-lib to version 4.0.37

* fix: adjust page number handling and improve article loading logic in Tags-Main component

* fix: update date display to use article's published date instead of author's creation date

* fix: add language detection and handling in article creation process

* fix: enhance SEO handling and improve language detection in article creation

* fix: update language confirmation message formatting in SeoView component

* fix: replace language detection with default English in article creation process

* fix: update language handling to use 'iso' instead of 'isoLang' and integrate language detection

* fix: enhance info message handling with optional auto-hide feature and improve loading state management

* fix: move click handler for sort button to the correct element in PublicationArticles component

* fix: update language handling for Portuguese to Brazilian Portuguese and adjust article filter sorting

* fix: update prevData structure to include mapped articles in Tags-Main component

* fix: remove debug logging from fallbackDataGenerate0 function in author.tag.ts

* fix: update @betarena/scores-lib to version 4.0.38 and improve article publish/unpublish handling with success checks

* fix: enhance article fetching and language handling, update total articles count in Tags components

* fix: remove unused 'article' field from request body in article POST handler

* fix: add optional chaining for tag.id and currentTag.permalink to prevent errors

* fix: update @betarena/scores-lib to version 4.0.39

* build(scores-lib): update to 4.0.40

---------

Co-authored-by: MigBash <[email protected]>
  • Loading branch information
Izobov and migbash authored Dec 1, 2024
1 parent 68dddd9 commit 525f9d6
Show file tree
Hide file tree
Showing 21 changed files with 378 additions and 123 deletions.
16 changes: 8 additions & 8 deletions .env.vault

Large diffs are not rendered by default.

52 changes: 48 additions & 4 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@betarena/ad-engine": "0.0.51",
"@betarena/scores-lib": "4.0.35",
"@betarena/scores-lib": "4.0.40",
"@lukeed/uuid": "2.0.1",
"@metamask/sdk": "0.1.0",
"@moralisweb3/client-firebase-auth-utils": "2.18.4",
Expand All @@ -75,6 +75,7 @@
"colorthief": "2.4.0",
"compression": "1.7.4",
"cookie": "0.5.0",
"cross-env": "7.0.3",
"device-detector-js": "3.0.3",
"dompurify": "3.1.6",
"dotenv": "16.3.1",
Expand All @@ -83,6 +84,7 @@
"express": "4.18.2",
"express-sslify": "1.2.0",
"firebase": "9.20.0",
"franc": "6.2.0",
"graphql-request": "5.1.0",
"graphql-subscriptions-client": "0.16.4",
"heroku-ssl-redirect": "0.1.1",
Expand All @@ -99,8 +101,7 @@
"unique-username-generator": "1.1.3",
"vite-plugin-css-injected-by-js": "3.2.1",
"vite-plugin-preload": "0.3.1",
"xml-formatter": "2.6.1",
"cross-env": "7.0.3"
"xml-formatter": "2.6.1"
},
"devDependencies": {
"@commitlint/cli": "17.8.1",
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/page/profile/PublicationCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
gap: 16px;
flex: 1 0 0;
width: 100%;
max-height: max-content;
&:hover {
Expand Down Expand Up @@ -127,7 +128,8 @@
border-radius: var(--radius-xl, 12px);
width: 100%;
border: 1px solid #E6E6E6;
height: 104px;
max-height: 104px;
height: 100%;
:global(.img) {
border-top-left-radius: var(--radius-xl, 12px);
Expand Down
54 changes: 48 additions & 6 deletions src/lib/components/page/profile/Widget-Author.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ COMPONENT JS (w/ TS)
import { get } from "$lib/api/utils.js";
import type { AuthorsAuthorsMain } from "@betarena/scores-lib/types/v8/_HASURA-0.js";
import PublicationCardLoader from "./PublicationCardLoader.svelte";
import EyeOffIcon from "$lib/components/ui/assets/eye-off-icon.svelte";
// #endregion ➤ 📦 Package Imports
Expand Down Expand Up @@ -61,7 +62,7 @@ COMPONENT JS (w/ TS)
if ($session.viewportType === "desktop" || !node || !showLoadButton) return;
const rect = node.getBoundingClientRect();
if (window.scrollY > rect.bottom - 20) {
loadMore()
loadMore();
}
}
Expand All @@ -83,11 +84,7 @@ COMPONENT JS (w/ TS)
);
loading = false;
if (res?.sportstacks) {
sportstacks = [...sportstacks, ...res.sportstacks].sort((a, b) => {
return (
new Date(b.data?.creation_date) - new Date(a.data?.creation_date)
);
});
sportstacks = [...sportstacks, ...res.sportstacks];
totalPages = Math.ceil(res.count / limitOfArticles);
}
}
Expand Down Expand Up @@ -151,6 +148,15 @@ COMPONENT JS (w/ TS)
<PublicationCardLoader />
{/each}
{/if}
{#if !sportstacks?.length && !loading}
<div class="no-content">
<EyeOffIcon />
<p>
{profileTrs?.no_publications_available ||
"No publications available, start creating content today!"}
</p>
</div>
{/if}
</div>
{#if showLoadButton && $session.viewportType === "desktop"}
<div class="load-more">
Expand Down Expand Up @@ -245,6 +251,36 @@ COMPONENT JS (w/ TS)
gap: var(--spacing-xl, 16px);
flex: 1 0 0;
align-self: stretch;
flex-grow: 1;
height: max-content;
.no-content {
height: max-content;
min-height: 300px;
width: 100%;
display: flex;
flex-grow: 1;
gap: 45px;
flex-direction: column;
align-items: center;
justify-content: center;
:global(svg) {
width: 32px;
height: 32px;
}
p {
margin: 0;
color: var(--colors-text-text-quaternary-500, #8c8c8c);
text-align: center;
/* Text md/Regular */
font-family: Roboto;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 150%; /* 21px */
}
}
}
.load-more {
Expand All @@ -268,13 +304,19 @@ COMPONENT JS (w/ TS)
}
}
.publications-wrapper {
// min-height: 632px;
gap: var(--spacing-3xl, 24px);
.no-content {
min-height: 632px;
}
}
}
&.desktop {
gap: 24px;
padding: 20px;
.header {
h2 {
font-size: var(--Font-size-text-xl, 20px);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@
case "unpublish":
modalState.component = Unpublish;
modalState.props = {
cb: () => {
publish({
cb: async () => {
const data = await publish({
id,
status: "unpublish",
sportstack: author,
translations,
});
article.status = "unpublished";
if (data.success) {
article.status = "unpublished";
}
},
translations,
};
Expand All @@ -188,8 +190,11 @@
modalState.component = DeleteModal;
break;
case "publish":
publish({ id, status: "publish", sportstack: author, translations });
article.status = "published";
publish({ id, status: "publish", sportstack: author, translations }).then(d => {
if (d.success) {
article.status = "published";
}
});
default:
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
</div>
<div
class="sort-by"
on:click|stopPropagation={() => (showSortBy = !showSortBy)}

>
<div class="sort-button">
<div class="sort-button" on:click|stopPropagation={() => (showSortBy = !showSortBy)}>
<Button type="terlary-gray">
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
let isSaved = false;
$: ({ article } = data);
$: id = article.id || 0;
$: id = article.id;
$: translations = (data as any).RESPONSE_PROFILE_DATA
.sportstack2 as TranslationSportstacksSectionDataJSONSchema;
Expand Down Expand Up @@ -148,6 +148,10 @@
description: article.seo_details?.main_data.description || "",
},
view: "preview",
detectedLang: {
lang: article.lang || "en",
iso: article.seo_details?.opengraph.locale || "en_US"
}
});
title = article.data?.title || "";
disablePublishButton =
Expand Down Expand Up @@ -198,7 +202,7 @@
const json = contentEditor.getJSON();
if (!json) return "";
for (const node of json.content || []) {
if (node.type === "paragraph") {
if (node.type === "paragraph" && node.content) {
return (node.content || []).map((n) => n.text).join(" ");
}
}
Expand Down
Loading

0 comments on commit 525f9d6

Please sign in to comment.