Skip to content

Commit 275a910

Browse files
Merge branch 'main' into patch-checkout-localisation
2 parents 8d361a0 + 59d5ba2 commit 275a910

File tree

14 files changed

+248
-190
lines changed

14 files changed

+248
-190
lines changed

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devprotocol/clubs-core",
3-
"version": "3.24.3-beta.0",
3+
"version": "3.26.6",
44
"description": "Core library for Clubs",
55
"main": "dist/index.mjs",
66
"exports": {
@@ -54,6 +54,16 @@
5454
},
5555
"./styles/variants": {
5656
"default": "./src/styles/clubs.variants.scss"
57+
},
58+
"./redis": {
59+
"import": "./dist/src/redis/index.mjs",
60+
"require": "./dist/src/redis/index.cjs",
61+
"types": "./redis.d.ts"
62+
},
63+
"./tailwind": {
64+
"import": "./dist/src/tailwind/index.mjs",
65+
"require": "./dist/src/tailwind/index.cjs",
66+
"types": "./tailwind.d.ts"
5767
}
5868
},
5969
"types": "./dist/clubs-core.d.ts",
@@ -94,8 +104,8 @@
94104
"license": "MIT",
95105
"dependencies": {
96106
"@devprotocol/dev-kit": "8.7.0",
97-
"@devprotocol/elements": "1.5.3",
98-
"@devprotocol/hashi": "2.4.0-beta.0",
107+
"@devprotocol/elements": "1.6.0",
108+
"@devprotocol/hashi": "2.4.0-beta.3",
99109
"@devprotocol/util-ts": "4.0.0",
100110
"@ethersproject/abstract-provider": "^5.7.0",
101111
"@metamask/detect-provider": "^2.0.0",
@@ -158,6 +168,7 @@
158168
"prettier-plugin-tailwindcss": "^0.4.0",
159169
"react": "18.3.1",
160170
"react-dom": "18.3.1",
171+
"redis": "^4.7.0",
161172
"rollup": "4.28.0",
162173
"rollup-plugin-dts": "6.1.1",
163174
"sass": "1.81.1",
@@ -182,6 +193,7 @@
182193
"lit": "^2.3.1 || ^3.0.0",
183194
"react": "^18.0.0",
184195
"react-dom": "^18.0.0",
196+
"redis": "^4.7.0",
185197
"svelte": "^3.49.0 || ^4.0.0 || ^5.0.0",
186198
"tailwindcss": "^3.2.4",
187199
"vue": "^3.2.0"

rollup.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ const majorCoreAPIs = [
88
'dist/src/images/index.js',
99
'dist/src/connection/index.js',
1010
'dist/src/styles/index.js',
11+
'dist/src/redis/index.js',
12+
'dist/src/tailwind/index.js',
1113
]
1214

1315
export const useSrc = ({ out, ext } = {}) => ({

src/redis/index.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { createClient } from 'redis'
2+
3+
type Options = typeof createClient extends (...args: infer Params) => unknown
4+
? Params
5+
: never
6+
export const defaultClient = (options?: Options) =>
7+
createClient({
8+
url: import.meta.env.REDIS_URL,
9+
username: import.meta.env.REDIS_USERNAME ?? '',
10+
password: import.meta.env.REDIS_PASSWORD ?? '',
11+
...options,
12+
})
13+
14+
type Redis = ReturnType<typeof defaultClient>
15+
16+
export const Redis = (() => {
17+
const instances: Map<string, Redis> = new Map()
18+
19+
const createInstance = (options?: Options) => {
20+
// eslint-disable-next-line functional/no-expression-statements
21+
console.log('$$$$$', 'new redis connection will be created')
22+
return defaultClient(options)
23+
}
24+
25+
return {
26+
client: async (params?: { key?: string; options: Options }) => {
27+
const key = params?.key ?? ''
28+
const fromCache = instances.get(key)
29+
const instance = fromCache
30+
? fromCache
31+
: (instances
32+
.set(key, createInstance(params?.options))
33+
.get(key) as Redis)
34+
// eslint-disable-next-line functional/no-conditional-statements
35+
if (instance.isOpen === false) {
36+
// eslint-disable-next-line functional/no-expression-statements
37+
await instance.connect()
38+
}
39+
return instance
40+
},
41+
}
42+
})()

src/styles/build/global.css

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@
9898
--hs-shadow-color: rgba(0, 0, 0, 0.15);
9999
}
100100

101-
*,
102-
:before,
103-
:after {
104-
margin: 0;
105-
padding: 0;
106-
color: inherit;
107-
box-sizing: inherit;
108-
}
109-
110101
h1,
111102
h2,
112103
h3,
@@ -119,15 +110,16 @@ h6 {
119110
line-height: inherit;
120111
}
121112

113+
/*
122114
p,
123115
span,
124116
a {
125-
font-family: var(--hs-theme-body-family);
126-
font-size: var(--hs-theme-body-size);
127-
font-weight: var(--hs-theme-body-weight);
128-
line-height: var(--hs-theme-body-line-height);
117+
font-family: hs-core.token-get('body-family');
118+
font-size: hs-core.token-get('body-size');
119+
font-weight: hs-core.token-get('body-weight');
120+
line-height: hs-core.token-get('body-line-height');
129121
}
130-
122+
*/
131123
a {
132124
text-decoration: none;
133125
}
@@ -151,10 +143,6 @@ code * {
151143
line-height: var(--hs-theme-mono-line-height);
152144
}
153145

154-
dialog {
155-
all: unset;
156-
}
157-
158146
html {
159147
width: 100%;
160148
height: 100%;

src/styles/build/global.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tailwind/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ export const clubs = {
1717
},
1818
plugins: [containerQueries],
1919
}
20+
21+
export default clubs

src/ui/components/Checkout/Checkout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ onUnmounted(() => {
599599

600600
<span
601601
v-if="!previewVideoSrc"
602-
class="size-24 rounded-lg border border-black/20 bg-black/10 p-1"
602+
class="h-auto min-h-24 w-24 rounded-lg border border-black/20 bg-black/10 p-1"
603603
>
604604
<img
605605
v-if="previewImageSrc"
@@ -629,7 +629,7 @@ onUnmounted(() => {
629629
<aside
630630
v-if="htmlDescription"
631631
v-html="htmlDescription"
632-
class="prose-hr:my-5 opacity-50"
632+
class="prose-hr:my-5"
633633
:class="ProseTextInherit"
634634
></aside>
635635

src/ui/components/Checkout/ModalCheckout.vue

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Strings } from './i18n'
44
import Skeleton from '../Skeleton/Skeleton.vue'
55
import { ProseTextInherit } from '../../../constants'
66
import { computed, onMounted, ref, useTemplateRef } from 'vue'
7-
import { UndefinedOr } from '@devprotocol/util-ts'
7+
import type { UndefinedOr } from '@devprotocol/util-ts'
88
import Spinner from '../../../layouts/components/Spinner.vue'
99
// @ts-ignore
1010
import VideoFetch from '../../vue/VideoFetch.vue'
@@ -22,6 +22,7 @@ const props = defineProps<{
2222
const cronCalling = ref<UndefinedOr<Promise<UndefinedOr<Response>>>>()
2323
const clicked = ref(false)
2424
const cronFinished = ref(false)
25+
const eoa = ref(props.eoa)
2526
2627
const imageRef = useTemplateRef(`imageRef`)
2728
@@ -30,11 +31,11 @@ let i18n = i18nBase(['en'])
3031
3132
const passportPageUrl = computed(() =>
3233
window.location.hostname.includes('prerelease.clubs.place')
33-
? `https://prerelease.clubs.place/passport/${props.eoa ?? ''}/edit`
34+
? `https://prerelease.clubs.place/passport/${eoa.value ?? ''}/edit`
3435
: window.location.hostname.includes('clubs.place')
35-
? `https://clubs.place/passport/${props.eoa ?? ''}/edit`
36+
? `https://clubs.place/passport/${eoa.value ?? ''}/edit`
3637
: `http://localhost:${window.location.port}/passport/${
37-
props.eoa ?? ''
38+
eoa.value ?? ''
3839
}/edit`
3940
)
4041
@@ -64,6 +65,12 @@ onMounted(async () => {
6465
} catch (error) {
6566
console.error('Error loading image:', error)
6667
}
68+
if (eoa.value === undefined) {
69+
const C = await import('../../../connection/connection')
70+
C.connection().account.subscribe((acc) => {
71+
eoa.value = acc
72+
})
73+
}
6774
})
6875
</script>
6976

@@ -140,8 +147,28 @@ onMounted(async () => {
140147

141148
<template>
142149
<div
143-
class="m-auto w-full max-w-screen-lg rounded-xl bg-white p-4 text-black shadow @container/clb_result_modal"
150+
class="relative w-full max-w-screen-lg rounded-xl bg-white p-4 text-black shadow @container/clb_result_modal"
144151
>
152+
<a
153+
:href="props.base ?? '/'"
154+
class="absolute -right-10 -top-10 flex h-8 w-8 items-center justify-center hover:bg-none"
155+
>
156+
<svg
157+
xmlns="http://www.w3.org/2000/svg"
158+
class="h-6 w-6"
159+
fill="none"
160+
viewBox="0 0 24 24"
161+
stroke="white"
162+
>
163+
<path
164+
stroke-linecap="round"
165+
stroke-linejoin="round"
166+
stroke-width="2"
167+
d="M6 18L18 6M6 6l12 12"
168+
/>
169+
</svg>
170+
</a>
171+
145172
<div
146173
class="bg-color-navy relative mb-6 flex h-auto min-h-52 w-full flex-col items-center justify-center overflow-hidden rounded-md border border-black p-2 @xl/clb_result_modal:h-96 @xl/clb_result_modal:min-h-0 @xl/clb_result_modal:p-8"
147174
>
@@ -159,12 +186,13 @@ onMounted(async () => {
159186
<img
160187
v-if="imageSrc"
161188
ref="imageRef"
162-
class="z-10 max-h-60 min-h-full max-w-60 object-contain @xl/clb_result_modal:max-h-none @xl/clb_result_modal:max-w-xl"
189+
class="z-10 max-h-60 min-h-full max-w-60 rounded-md object-contain @xl/clb_result_modal:max-h-none @xl/clb_result_modal:max-w-xl"
163190
/>
164191
<!-- video -->
165192
<VideoFetch
166193
v-if="!imageSrc && videoSrc"
167-
class="max-w-60 rounded"
194+
class="aspect-[1/1] max-w-60 rounded-md"
195+
video-class="rounded-md [&>video]:rounded-md"
168196
:url="videoSrc"
169197
/>
170198
<span class="text-base italic text-white">
@@ -210,7 +238,7 @@ onMounted(async () => {
210238
:href="props.base ?? '/'"
211239
class="hs-button is-filled rounded-lg border px-12 py-4 text-base @4xl/clb_result_modal:py-6"
212240
>
213-
{{ i18n('Home') }}
241+
{{ i18n('ContinueShopping') }}
214242
</a>
215243
<button
216244
v-if="false /* HIDDEN FOR NOW */"

0 commit comments

Comments
 (0)