mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
feat: add input regex filter to universalform, add filter to onboarding, add .env.examples along with gitignore exemption, and improve dev guide by a bit
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,6 +28,7 @@ yarn-error.log*
|
||||
# local env files
|
||||
.env*.local
|
||||
.env*
|
||||
!.env.example
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
@@ -5,30 +5,41 @@ description: Instructions to set up a local development environment for hackclub
|
||||
|
||||
1. clone repo
|
||||
2. `pnpm install`
|
||||
3. `pnpm dev`
|
||||
4. `pnpm db:migrate` (RUN THIS AFTER POPULATING BELOW ENV)
|
||||
3. `cp apps/web/.env.example apps/web/.env && cp packages/db/.env.example packages/db/.env`
|
||||
4. `pnpm dev`
|
||||
5. `pnpm db:migrate` (RUN THIS AFTER POPULATING ENV)
|
||||
|
||||
- create file at apps/web/.env:
|
||||
- create file at apps/web/.env (skip if you did step 3):
|
||||
```
|
||||
DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
|
||||
# make a slack app here: https://api.slack.com/apps
|
||||
SLACK_NOTIFIER_TOKEN=<make a bot for this, check app manifest below>
|
||||
|
||||
# invite your bot to the channel you created. below is #hctv-dev, so use that if you want!
|
||||
NOTIFICATION_CHANNEL_ID=C08M3MGE6PJ
|
||||
|
||||
REDIS_URL=redis://localhost:6379
|
||||
|
||||
# get from https://uploadthing.com/
|
||||
UPLOADTHING_TOKEN=<get from uploadthing>
|
||||
# enable oauth mode on your hca account
|
||||
|
||||
# enable oauth mode on your hca account and make an app: https://auth.hackclub.com/identity/edit
|
||||
HCID_CLIENT=<auth.hackclub.com client>
|
||||
HCID_SECRET=<auth.hackclub.com secret>
|
||||
# make sure to put this as one of the redirect uri
|
||||
HCID_REDIRECT_URI=http://localhost:3000/auth/hackclub/callback
|
||||
|
||||
# mediamtx settings
|
||||
NEXT_PUBLIC_MEDIAMTX_URL=http://localhost:8891
|
||||
MEDIAMTX_API=http://localhost:9997
|
||||
|
||||
# idt you should change this
|
||||
MEDIAMTX_PUBLISH_KEY=rjq1xdpCPA4qyt3jge
|
||||
NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE=localhost:8890
|
||||
```
|
||||
|
||||
- create file at packages/db/.env:
|
||||
- create file at packages/db/.env (skip if you did step 3):
|
||||
```
|
||||
DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
DATABASE_DIRECT_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
|
||||
26
apps/web/.env.example
Normal file
26
apps/web/.env.example
Normal file
@@ -0,0 +1,26 @@
|
||||
DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
|
||||
# make a slack app here: https://api.slack.com/apps
|
||||
SLACK_NOTIFIER_TOKEN=<make a bot for this, check app manifest below>
|
||||
|
||||
# invite your bot to the channel you created. below is #hctv-dev, so use that if you want!
|
||||
NOTIFICATION_CHANNEL_ID=C08M3MGE6PJ
|
||||
|
||||
REDIS_URL=redis://localhost:6379
|
||||
|
||||
# get from https://uploadthing.com/
|
||||
UPLOADTHING_TOKEN=<get from uploadthing>
|
||||
|
||||
# enable oauth mode on your hca account and make an app: https://auth.hackclub.com/identity/edit
|
||||
HCID_CLIENT=<auth.hackclub.com client>
|
||||
HCID_SECRET=<auth.hackclub.com secret>
|
||||
# make sure to put this as one of the redirect uri
|
||||
HCID_REDIRECT_URI=http://localhost:3000/auth/hackclub/callback
|
||||
|
||||
# mediamtx settings
|
||||
NEXT_PUBLIC_MEDIAMTX_URL=http://localhost:8891
|
||||
MEDIAMTX_API=http://localhost:9997
|
||||
|
||||
# idt you should change this
|
||||
MEDIAMTX_PUBLISH_KEY=rjq1xdpCPA4qyt3jge
|
||||
NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE=localhost:8890
|
||||
@@ -107,7 +107,9 @@ export default function OnboardingClient() {
|
||||
name: 'username',
|
||||
label: 'Channel Username',
|
||||
type: 'text',
|
||||
placeholder: 'e.g., yourname or yourname-codes'
|
||||
placeholder: 'e.g., yourname or yourname-codes',
|
||||
maxChars: 20,
|
||||
inputFilter: /[^a-z0-9_-]/g,
|
||||
},
|
||||
]}
|
||||
schemaName="onboard"
|
||||
|
||||
@@ -97,13 +97,21 @@ export function UniversalForm<T extends z.ZodType>({
|
||||
{...formField}
|
||||
value={formField.value ?? ''}
|
||||
rows={field.textAreaRows ?? 5}
|
||||
maxLength={field.maxChars}
|
||||
/>
|
||||
) : (
|
||||
<Input
|
||||
type={field.type || 'text'}
|
||||
placeholder={field.placeholder}
|
||||
{...formField}
|
||||
onChange={(e) => {
|
||||
if (field.inputFilter) {
|
||||
e.target.value = e.target.value.replace(field.inputFilter, '');
|
||||
}
|
||||
formField.onChange(e);
|
||||
}}
|
||||
value={formField.value ?? ''}
|
||||
maxLength={field.maxChars}
|
||||
/>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
@@ -12,6 +12,8 @@ export type FormFieldConfig = {
|
||||
value?: any;
|
||||
textArea?: boolean;
|
||||
textAreaRows?: number;
|
||||
maxChars?: number;
|
||||
inputFilter?: RegExp;
|
||||
component?: (props: { field: ControllerRenderProps<any, any> } & any) => React.ReactNode;
|
||||
componentProps?: Record<string, any>;
|
||||
required?: boolean;
|
||||
|
||||
2
packages/db/.env.example
Normal file
2
packages/db/.env.example
Normal file
@@ -0,0 +1,2 @@
|
||||
DATABASE_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
DATABASE_DIRECT_URL=postgresql://postgres:skbiditoilet@localhost:5555/postgres
|
||||
Reference in New Issue
Block a user