From 4b063c92b923a6ac265cc2449ef147109e40aa62 Mon Sep 17 00:00:00 2001 From: Zouheir Layine Date: Fri, 22 Nov 2024 11:44:38 +0100 Subject: [PATCH] [PLA-1973] add dynamic banner (#177) --- resources/js/api/index.ts | 9 +++ resources/js/api/queries.ts | 2 + resources/js/components/App.vue | 26 ++++--- resources/js/components/DynamicBanner.vue | 88 +++++++++++++++++++++++ resources/js/graphql/query/GetBanners.ts | 9 +++ 5 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 resources/js/components/DynamicBanner.vue create mode 100644 resources/js/graphql/query/GetBanners.ts diff --git a/resources/js/api/index.ts b/resources/js/api/index.ts index c15b185..508e84c 100644 --- a/resources/js/api/index.ts +++ b/resources/js/api/index.ts @@ -2,6 +2,7 @@ import { HttpMethods } from '~/types/types.enums'; import mutations from '~/api/mutations'; import snackbar from '~/util/snackbar'; import { useAppStore } from '~/store'; +import queries from './queries'; export class ApiService { static async reloadCsrf() { @@ -265,4 +266,12 @@ export class ApiService { return ApiService.sendPlatformRequest(data); } + + static async getBanners() { + const data = { + query: queries.GetBanners, + }; + + return ApiService.sendPlatformRequest(data); + } } diff --git a/resources/js/api/queries.ts b/resources/js/api/queries.ts index bb590d4..d350739 100644 --- a/resources/js/api/queries.ts +++ b/resources/js/api/queries.ts @@ -28,6 +28,7 @@ import GetListings from '~/graphql/query/marketplace/GetListings'; import GetBids from '~/graphql/query/marketplace/GetBids'; import GetSales from '~/graphql/query/marketplace/GetSales'; import GetBlocks from '~/graphql/query/marketplace/GetBlocks'; +import GetBanners from '~/graphql/query/GetBanners'; export default { GetTransaction, @@ -60,4 +61,5 @@ export default { GetBids, GetSales, GetBlocks, + GetBanners, }; diff --git a/resources/js/components/App.vue b/resources/js/components/App.vue index 195fd23..ffe2aa2 100644 --- a/resources/js/components/App.vue +++ b/resources/js/components/App.vue @@ -1,16 +1,19 @@ @@ -24,6 +27,7 @@ import SnackbarGroup from '~/components/SnackbarGroup.vue'; import UserNavbar from '~/components/UserNavbar.vue'; import { computed, watch } from 'vue'; import { useRouter } from 'vue-router'; +import DynamicBanner from './DynamicBanner.vue'; const appStore = useAppStore(); const router = useRouter(); diff --git a/resources/js/components/DynamicBanner.vue b/resources/js/components/DynamicBanner.vue new file mode 100644 index 0000000..79341d3 --- /dev/null +++ b/resources/js/components/DynamicBanner.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/resources/js/graphql/query/GetBanners.ts b/resources/js/graphql/query/GetBanners.ts new file mode 100644 index 0000000..c75f9d1 --- /dev/null +++ b/resources/js/graphql/query/GetBanners.ts @@ -0,0 +1,9 @@ +export default `query { + GetBanners { + key + text + link + linkText + dismissable + } +}`;