@dubsdotapp/expo 0.2.76 → 0.2.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +122 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +122 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ui/AuthGate.tsx +37 -14
- package/src/ui/UserProfileSheet.tsx +80 -33
package/dist/index.mjs
CHANGED
|
@@ -2481,11 +2481,23 @@ var DICEBEAR_STYLES = [
|
|
|
2481
2481
|
"big-smile",
|
|
2482
2482
|
"thumbs"
|
|
2483
2483
|
];
|
|
2484
|
+
var BG_COLORS = [
|
|
2485
|
+
"1a1a2e",
|
|
2486
|
+
"f43f5e",
|
|
2487
|
+
"f97316",
|
|
2488
|
+
"eab308",
|
|
2489
|
+
"22c55e",
|
|
2490
|
+
"3b82f6",
|
|
2491
|
+
"8b5cf6",
|
|
2492
|
+
"ec4899",
|
|
2493
|
+
"06b6d4",
|
|
2494
|
+
"64748b"
|
|
2495
|
+
];
|
|
2484
2496
|
function generateSeed() {
|
|
2485
2497
|
return Math.random().toString(36).slice(2, 10);
|
|
2486
2498
|
}
|
|
2487
|
-
function getAvatarUrl(style, seed, size = 256) {
|
|
2488
|
-
return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&size=${size}`;
|
|
2499
|
+
function getAvatarUrl(style, seed, bg = "1a1a2e", size = 256) {
|
|
2500
|
+
return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&backgroundColor=${bg}&size=${size}`;
|
|
2489
2501
|
}
|
|
2490
2502
|
function AuthGate({
|
|
2491
2503
|
children,
|
|
@@ -2665,6 +2677,7 @@ function DefaultRegistrationScreen({
|
|
|
2665
2677
|
const [step, setStep] = useState15(0);
|
|
2666
2678
|
const [avatarSeed, setAvatarSeed] = useState15(generateSeed);
|
|
2667
2679
|
const [avatarStyle, setAvatarStyle] = useState15("adventurer");
|
|
2680
|
+
const [avatarBg, setAvatarBg] = useState15("1a1a2e");
|
|
2668
2681
|
const [showStyles, setShowStyles] = useState15(false);
|
|
2669
2682
|
const [username, setUsername] = useState15("");
|
|
2670
2683
|
const [referralCode, setReferralCode] = useState15("");
|
|
@@ -2673,7 +2686,7 @@ function DefaultRegistrationScreen({
|
|
|
2673
2686
|
const debounceRef = useRef4(null);
|
|
2674
2687
|
const fadeAnim = useRef4(new Animated.Value(1)).current;
|
|
2675
2688
|
const slideAnim = useRef4(new Animated.Value(0)).current;
|
|
2676
|
-
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed);
|
|
2689
|
+
const avatarUrl = getAvatarUrl(avatarStyle, avatarSeed, avatarBg);
|
|
2677
2690
|
useEffect10(() => {
|
|
2678
2691
|
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2679
2692
|
const trimmed = username.trim();
|
|
@@ -2746,15 +2759,30 @@ function DefaultRegistrationScreen({
|
|
|
2746
2759
|
}
|
|
2747
2760
|
)
|
|
2748
2761
|
] }),
|
|
2749
|
-
showStyles && /* @__PURE__ */
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2762
|
+
showStyles && /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2763
|
+
/* @__PURE__ */ jsx3(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: DICEBEAR_STYLES.map((st) => /* @__PURE__ */ jsx3(
|
|
2764
|
+
TouchableOpacity2,
|
|
2765
|
+
{
|
|
2766
|
+
onPress: () => setAvatarStyle(st),
|
|
2767
|
+
style: [s.styleThumbWrap, { borderColor: st === avatarStyle ? accent : t.border }],
|
|
2768
|
+
children: /* @__PURE__ */ jsx3(Image2, { source: { uri: getAvatarUrl(st, avatarSeed, avatarBg, 80) }, style: s.styleThumb })
|
|
2769
|
+
},
|
|
2770
|
+
st
|
|
2771
|
+
)) }),
|
|
2772
|
+
/* @__PURE__ */ jsx3(Text2, { style: [s.subtitle, { color: t.textMuted, marginTop: 8 }], children: "Background Color" }),
|
|
2773
|
+
/* @__PURE__ */ jsx3(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: s.styleScroll, children: BG_COLORS.map((color) => /* @__PURE__ */ jsx3(
|
|
2774
|
+
TouchableOpacity2,
|
|
2775
|
+
{
|
|
2776
|
+
onPress: () => setAvatarBg(color),
|
|
2777
|
+
style: [
|
|
2778
|
+
s.colorSwatch,
|
|
2779
|
+
{ backgroundColor: `#${color}` },
|
|
2780
|
+
color === avatarBg && { borderColor: accent, borderWidth: 2.5 }
|
|
2781
|
+
]
|
|
2782
|
+
},
|
|
2783
|
+
color
|
|
2784
|
+
)) })
|
|
2785
|
+
] })
|
|
2758
2786
|
] }),
|
|
2759
2787
|
/* @__PURE__ */ jsx3(View2, { style: s.bottomRow, children: /* @__PURE__ */ jsx3(
|
|
2760
2788
|
TouchableOpacity2,
|
|
@@ -3065,6 +3093,7 @@ var s = StyleSheet2.create({
|
|
|
3065
3093
|
styleScroll: { paddingHorizontal: 24, marginTop: 4 },
|
|
3066
3094
|
styleThumbWrap: { borderWidth: 2, borderRadius: 12, padding: 3, marginRight: 10 },
|
|
3067
3095
|
styleThumb: { width: 52, height: 52, borderRadius: 10, backgroundColor: "#E5E5EA" },
|
|
3096
|
+
colorSwatch: { width: 32, height: 32, borderRadius: 16, borderWidth: 1.5, borderColor: "rgba(255,255,255,0.15)", marginRight: 10 },
|
|
3068
3097
|
// Input
|
|
3069
3098
|
inputGroup: { paddingHorizontal: 24, gap: 6 },
|
|
3070
3099
|
inputLabel: { fontSize: 15, fontWeight: "600" },
|
|
@@ -3533,20 +3562,35 @@ var DICEBEAR_STYLES2 = [
|
|
|
3533
3562
|
"big-smile",
|
|
3534
3563
|
"thumbs"
|
|
3535
3564
|
];
|
|
3565
|
+
var BG_COLORS2 = [
|
|
3566
|
+
"1a1a2e",
|
|
3567
|
+
"f43f5e",
|
|
3568
|
+
"f97316",
|
|
3569
|
+
"eab308",
|
|
3570
|
+
"22c55e",
|
|
3571
|
+
"3b82f6",
|
|
3572
|
+
"8b5cf6",
|
|
3573
|
+
"ec4899",
|
|
3574
|
+
"06b6d4",
|
|
3575
|
+
"64748b"
|
|
3576
|
+
];
|
|
3536
3577
|
function generateSeed2() {
|
|
3537
3578
|
return Math.random().toString(36).slice(2, 10);
|
|
3538
3579
|
}
|
|
3539
|
-
function getAvatarUrl2(style, seed, size = 256) {
|
|
3540
|
-
return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&size=${size}`;
|
|
3580
|
+
function getAvatarUrl2(style, seed, bg = "1a1a2e", size = 256) {
|
|
3581
|
+
return `https://api.dicebear.com/9.x/${style}/png?seed=${seed}&backgroundColor=${bg}&size=${size}`;
|
|
3541
3582
|
}
|
|
3542
3583
|
function parseAvatarUrl(url) {
|
|
3543
|
-
if (!url) return { style: "adventurer", seed: generateSeed2() };
|
|
3584
|
+
if (!url) return { style: "adventurer", seed: generateSeed2(), bg: "1a1a2e" };
|
|
3544
3585
|
try {
|
|
3545
3586
|
const match = url.match(/\/\d+\.x\/([^/]+)\/(?:png|svg)\?seed=([^&]+)/);
|
|
3546
|
-
if (match)
|
|
3587
|
+
if (match) {
|
|
3588
|
+
const bgMatch = url.match(/backgroundColor=([^&]+)/);
|
|
3589
|
+
return { style: match[1], seed: match[2], bg: bgMatch?.[1] || "1a1a2e" };
|
|
3590
|
+
}
|
|
3547
3591
|
} catch {
|
|
3548
3592
|
}
|
|
3549
|
-
return { style: "adventurer", seed: generateSeed2() };
|
|
3593
|
+
return { style: "adventurer", seed: generateSeed2(), bg: "1a1a2e" };
|
|
3550
3594
|
}
|
|
3551
3595
|
function truncateAddress3(address, chars = 4) {
|
|
3552
3596
|
if (address.length <= chars * 2 + 3) return address;
|
|
@@ -3566,12 +3610,14 @@ function UserProfileSheet({
|
|
|
3566
3610
|
const parsed = useMemo4(() => parseAvatarUrl(user.avatar), [user.avatar]);
|
|
3567
3611
|
const [avatarStyle, setAvatarStyle] = useState17(parsed.style);
|
|
3568
3612
|
const [avatarSeed, setAvatarSeed] = useState17(parsed.seed);
|
|
3613
|
+
const [bgColor, setBgColor] = useState17(parsed.bg);
|
|
3569
3614
|
const [saving, setSaving] = useState17(false);
|
|
3570
3615
|
const [error, setError] = useState17(null);
|
|
3571
3616
|
useEffect12(() => {
|
|
3572
3617
|
const p = parseAvatarUrl(user.avatar);
|
|
3573
3618
|
setAvatarStyle(p.style);
|
|
3574
3619
|
setAvatarSeed(p.seed);
|
|
3620
|
+
setBgColor(p.bg);
|
|
3575
3621
|
}, [user.avatar]);
|
|
3576
3622
|
useEffect12(() => {
|
|
3577
3623
|
Animated2.timing(overlayOpacity, {
|
|
@@ -3583,28 +3629,8 @@ function UserProfileSheet({
|
|
|
3583
3629
|
useEffect12(() => {
|
|
3584
3630
|
if (visible) setError(null);
|
|
3585
3631
|
}, [visible]);
|
|
3586
|
-
const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed);
|
|
3587
|
-
const
|
|
3588
|
-
async (style) => {
|
|
3589
|
-
const newUrl = getAvatarUrl2(style, avatarSeed);
|
|
3590
|
-
setAvatarStyle(style);
|
|
3591
|
-
setSaving(true);
|
|
3592
|
-
setError(null);
|
|
3593
|
-
try {
|
|
3594
|
-
await client.updateProfile({ avatar: newUrl });
|
|
3595
|
-
onAvatarUpdated?.(newUrl);
|
|
3596
|
-
} catch (err) {
|
|
3597
|
-
setError(err instanceof Error ? err.message : "Failed to update avatar");
|
|
3598
|
-
} finally {
|
|
3599
|
-
setSaving(false);
|
|
3600
|
-
}
|
|
3601
|
-
},
|
|
3602
|
-
[avatarSeed, client, onAvatarUpdated]
|
|
3603
|
-
);
|
|
3604
|
-
const handleShuffle = useCallback16(async () => {
|
|
3605
|
-
const newSeed = generateSeed2();
|
|
3606
|
-
const newUrl = getAvatarUrl2(avatarStyle, newSeed);
|
|
3607
|
-
setAvatarSeed(newSeed);
|
|
3632
|
+
const currentAvatarUrl = getAvatarUrl2(avatarStyle, avatarSeed, bgColor);
|
|
3633
|
+
const saveAvatar = useCallback16(async (newUrl) => {
|
|
3608
3634
|
setSaving(true);
|
|
3609
3635
|
setError(null);
|
|
3610
3636
|
try {
|
|
@@ -3615,7 +3641,26 @@ function UserProfileSheet({
|
|
|
3615
3641
|
} finally {
|
|
3616
3642
|
setSaving(false);
|
|
3617
3643
|
}
|
|
3618
|
-
}, [
|
|
3644
|
+
}, [client, onAvatarUpdated]);
|
|
3645
|
+
const handleSelectStyle = useCallback16(
|
|
3646
|
+
(style) => {
|
|
3647
|
+
setAvatarStyle(style);
|
|
3648
|
+
saveAvatar(getAvatarUrl2(style, avatarSeed, bgColor));
|
|
3649
|
+
},
|
|
3650
|
+
[avatarSeed, bgColor, saveAvatar]
|
|
3651
|
+
);
|
|
3652
|
+
const handleShuffle = useCallback16(() => {
|
|
3653
|
+
const newSeed = generateSeed2();
|
|
3654
|
+
setAvatarSeed(newSeed);
|
|
3655
|
+
saveAvatar(getAvatarUrl2(avatarStyle, newSeed, bgColor));
|
|
3656
|
+
}, [avatarStyle, bgColor, saveAvatar]);
|
|
3657
|
+
const handleSelectBgColor = useCallback16(
|
|
3658
|
+
(color) => {
|
|
3659
|
+
setBgColor(color);
|
|
3660
|
+
saveAvatar(getAvatarUrl2(avatarStyle, avatarSeed, color));
|
|
3661
|
+
},
|
|
3662
|
+
[avatarStyle, avatarSeed, saveAvatar]
|
|
3663
|
+
);
|
|
3619
3664
|
return /* @__PURE__ */ jsxs5(
|
|
3620
3665
|
Modal,
|
|
3621
3666
|
{
|
|
@@ -3696,7 +3741,7 @@ function UserProfileSheet({
|
|
|
3696
3741
|
children: /* @__PURE__ */ jsx7(
|
|
3697
3742
|
Image4,
|
|
3698
3743
|
{
|
|
3699
|
-
source: { uri: getAvatarUrl2(style, avatarSeed, 80) },
|
|
3744
|
+
source: { uri: getAvatarUrl2(style, avatarSeed, bgColor, 80) },
|
|
3700
3745
|
style: styles4.styleTileImage
|
|
3701
3746
|
}
|
|
3702
3747
|
)
|
|
@@ -3705,6 +3750,32 @@ function UserProfileSheet({
|
|
|
3705
3750
|
);
|
|
3706
3751
|
})
|
|
3707
3752
|
}
|
|
3753
|
+
),
|
|
3754
|
+
/* @__PURE__ */ jsx7(Text5, { style: [styles4.sectionLabel, { color: t.textSecondary, marginTop: 4 }], children: "Background Color" }),
|
|
3755
|
+
/* @__PURE__ */ jsx7(
|
|
3756
|
+
ScrollView3,
|
|
3757
|
+
{
|
|
3758
|
+
horizontal: true,
|
|
3759
|
+
showsHorizontalScrollIndicator: false,
|
|
3760
|
+
contentContainerStyle: styles4.colorPickerContent,
|
|
3761
|
+
children: BG_COLORS2.map((color) => {
|
|
3762
|
+
const isSelected = color === bgColor;
|
|
3763
|
+
return /* @__PURE__ */ jsx7(
|
|
3764
|
+
TouchableOpacity4,
|
|
3765
|
+
{
|
|
3766
|
+
onPress: () => handleSelectBgColor(color),
|
|
3767
|
+
activeOpacity: 0.7,
|
|
3768
|
+
disabled: saving,
|
|
3769
|
+
style: [
|
|
3770
|
+
styles4.colorSwatch,
|
|
3771
|
+
{ backgroundColor: `#${color}` },
|
|
3772
|
+
isSelected && { borderColor: t.accent, borderWidth: 2.5 }
|
|
3773
|
+
]
|
|
3774
|
+
},
|
|
3775
|
+
color
|
|
3776
|
+
);
|
|
3777
|
+
})
|
|
3778
|
+
}
|
|
3708
3779
|
)
|
|
3709
3780
|
] }),
|
|
3710
3781
|
error ? /* @__PURE__ */ jsx7(View5, { style: [styles4.errorBox, { backgroundColor: t.errorBg, borderColor: t.errorBorder }], children: /* @__PURE__ */ jsx7(Text5, { style: [styles4.errorText, { color: t.errorText }], children: error }) }) : null,
|
|
@@ -3866,6 +3937,16 @@ var styles4 = StyleSheet5.create({
|
|
|
3866
3937
|
stylePickerContent: {
|
|
3867
3938
|
gap: 10
|
|
3868
3939
|
},
|
|
3940
|
+
colorPickerContent: {
|
|
3941
|
+
gap: 8
|
|
3942
|
+
},
|
|
3943
|
+
colorSwatch: {
|
|
3944
|
+
width: 32,
|
|
3945
|
+
height: 32,
|
|
3946
|
+
borderRadius: 16,
|
|
3947
|
+
borderWidth: 1.5,
|
|
3948
|
+
borderColor: "rgba(255,255,255,0.15)"
|
|
3949
|
+
},
|
|
3869
3950
|
styleTile: {
|
|
3870
3951
|
width: 72,
|
|
3871
3952
|
height: 72,
|