Skip to content

Commit

Permalink
feat(expo-bbq): adding a base user schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
h0lybyte committed Nov 11, 2024
1 parent a96ebee commit f5cf658
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/expo-bbq/src/components/auth/user/TamaOnboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useCallback, useMemo, useEffect } from 'react';
import { YStack, Input, Button, TextArea, Text } from 'tamagui';
import { createSupabaseClient } from '../../wrapper/Supabase';
import { socialsSchema, styleSchema } from './UserSchema';

export function TamaOnboard({
supabaseUrl,
Expand Down
16 changes: 16 additions & 0 deletions packages/expo-bbq/src/components/auth/user/UserSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { z } from 'zod';

// Socials schema
export const socialsSchema = z.object({
twitter: z.string().url().regex(/^https:\/\/(www\.)?twitter.com\/[a-zA-Z0-9_]{1,15}\/?$/).optional(),
github: z.string().url().regex(/^https:\/\/(www\.)?github.com\/[a-zA-Z0-9_-]+\/?$/).optional(),
linkedin: z.string().url().regex(/^https:\/\/(www\.)?linkedin.com\/in\/[a-zA-Z0-9_-]+\/?$/).optional(),
website: z.string().url().optional(),
}).partial();

// Style schema
export const styleSchema = z.object({
colors: z.array(z.string().regex(/^#[A-Fa-f0-9]{8}$/)).max(10).optional(),
cover: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional(),
background: z.string().regex(/^[a-zA-Z0-9_-]+$/).optional(),
}).partial();

0 comments on commit f5cf658

Please sign in to comment.