26 | Sorry, this resource doesn’t exist or it was removed
27 |
28 |
29 |
30 |
31 | )
32 |
33 | export default FourOhFour
34 |
--------------------------------------------------------------------------------
/apps/embed/src/pages/500.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const ErrorPage = () => (
16 |
17 |
18 |
19 |
20 | Oops!
21 |
22 |
23 | Sorry, something went wrong
24 |
25 |
26 |
27 |
28 | )
29 |
30 | export default ErrorPage
31 |
--------------------------------------------------------------------------------
/apps/embed/src/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import '../styles/globals.css'
16 | import type { AppProps } from 'next/app'
17 |
18 | const MyApp = ({ Component, pageProps }: AppProps) => (
19 |
20 | )
21 |
22 | export default MyApp
23 |
--------------------------------------------------------------------------------
/apps/embed/src/styles/globals.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
5 | html {
6 | scroll-behavior: smooth;
7 | color-scheme: dark;
8 | @apply text-gray-800
9 | }
10 | a {
11 | color: inherit;
12 | text-decoration: none;
13 | }
14 |
15 | h1,
16 | h2,
17 | h3,
18 | h4,
19 | h5,
20 | h6 {
21 | @apply font-main;
22 | }
23 |
24 | body {
25 | @apply font-body;
26 | }
27 |
28 | * {
29 | box-sizing: border-box;
30 | }
31 |
32 | ::-moz-selection {
33 | /* Code for Firefox */
34 |
35 | @apply bg-green-600 text-white;
36 | }
37 |
38 | ::selection {
39 | @apply bg-green-600 text-white;
40 | }
41 |
42 | @layer base {
43 | /* Gilroy ExtraBold - Subsetting : Latin */
44 | @font-face {
45 | font-family: "Gilroy";
46 | font-style: normal;
47 | font-weight: 800;
48 | font-display: optional;
49 | src: url("/fonts/Gilroy/gilroy-extrabold-latin.woff2") format("woff2");
50 | }
51 |
52 | /* Gilroy Bold - Subsetting : Latin */
53 | @font-face {
54 | font-family: "Gilroy";
55 | font-style: normal;
56 | font-weight: 700;
57 | font-display: optional;
58 | src: url("/fonts/Gilroy/gilroy-bold-latin.woff2") format("woff2");
59 | }
60 |
61 | /* Gilroy SemiBold - Subsetting : Latin */
62 | @font-face {
63 | font-family: "Gilroy";
64 | font-style: normal;
65 | font-weight: 600;
66 | font-display: optional;
67 | src: url("/fonts/Gilroy/gilroy-semibold-latin.woff2") format("woff2");
68 | }
69 |
70 | /* Inter Variable - Subsetting : Latin */
71 | @font-face {
72 | font-family: "Inter";
73 | font-style: normal;
74 | font-weight: 100 900;
75 | font-display: optional;
76 | src: url("/fonts/Inter/inter-var-latin.woff2") format("woff2");
77 | }
78 | }
79 |
80 |
--------------------------------------------------------------------------------
/apps/embed/src/utils/env.d.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | declare global {
16 | namespace NodeJS {
17 | interface ProcessEnv {
18 | NEXT_PUBLIC_CDN_URL: string
19 | NEXT_PUBLIC_EMBED_URL: string
20 | DATABASE_URL: string
21 | }
22 | }
23 | }
24 |
25 | export {}
26 |
--------------------------------------------------------------------------------
/apps/embed/src/utils/trpc.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable @typescript-eslint/naming-convention */
16 | import { createReactQueryHooks } from '@trpc/react'
17 | import type { inferProcedureInput, inferProcedureOutput } from '@trpc/server'
18 | import { AppRouter } from 'server/routes/route'
19 |
20 | const trpc = createReactQueryHooks()
21 |
22 | /**
23 | * This is a helper method to infer the output of a query resolver
24 | * @example type HelloOutput = inferQueryOutput<'hello'>
25 | */
26 | export type inferQueryOutput<
27 | TRouteKey extends keyof AppRouter['_def']['queries']
28 | > = inferProcedureOutput
29 |
30 | export type inferQueryInput<
31 | TRouteKey extends keyof AppRouter['_def']['queries']
32 | > = inferProcedureInput
33 |
34 | export type inferMutationOutput<
35 | TRouteKey extends keyof AppRouter['_def']['mutations']
36 | > = inferProcedureOutput
37 |
38 | export type inferMutationInput<
39 | TRouteKey extends keyof AppRouter['_def']['mutations']
40 | > = inferProcedureInput
41 |
42 | export default trpc
43 |
--------------------------------------------------------------------------------
/apps/embed/src/utils/useWindowDimensions.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useState, useEffect } from 'react'
16 |
17 | function getWindowDimensions() {
18 | const { innerWidth: width, innerHeight: height } = window
19 | return {
20 | width,
21 | height,
22 | }
23 | }
24 |
25 | export default function useWindowDimensions() {
26 | const [windowDimensions, setWindowDimensions] = useState<{
27 | width: number
28 | height: number
29 | }>({
30 | width: 0,
31 | height: 0,
32 | })
33 |
34 | useEffect(() => {
35 | setWindowDimensions(getWindowDimensions())
36 | function handleResize() {
37 | setWindowDimensions(getWindowDimensions())
38 | }
39 |
40 | window.addEventListener('resize', handleResize)
41 | return () => window.removeEventListener('resize', handleResize)
42 | }, [])
43 |
44 | return windowDimensions
45 | }
46 |
--------------------------------------------------------------------------------
/apps/embed/svg/404.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/apps/embed/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('config/tailwind.config')
2 |
--------------------------------------------------------------------------------
/apps/embed/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-next.json",
3 | "compilerOptions": {
4 | "baseUrl": ".",
5 | "strict": true,
6 | "disableSizeLimit": true,
7 | "declaration": false,
8 | "declarationMap": false,
9 | "skipLibCheck": true
10 | },
11 | "paths": {
12 | "@/*": ["./src/*"]
13 | },
14 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
15 | "exclude": ["node_modules"]
16 | }
17 |
--------------------------------------------------------------------------------
/apps/firebase-functions/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintNode = require('config/eslint-node.js')
2 |
3 | module.exports = {
4 | ...eslintNode,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | sourceType: 'module',
9 | ecmaVersion: 2020,
10 | },
11 | }
12 |
--------------------------------------------------------------------------------
/apps/firebase-functions/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "incredibledev-next-staging"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/apps/firebase-functions/README.md:
--------------------------------------------------------------------------------
1 | ## Secrets
2 |
3 | ref :
4 |
5 | ```
6 | firebase functions:secrets:set WEBHOOK_SECRET
7 | ```
8 |
--------------------------------------------------------------------------------
/apps/firebase-functions/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "functions": {
3 | "source": ".",
4 | "predeploy": [
5 | "npm --prefix \"$RESOURCE_DIR\" run lint",
6 | "npm --prefix \"$RESOURCE_DIR\" run build"
7 | ]
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/apps/firebase-functions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "functions",
3 | "version": "0.0.0",
4 | "scripts": {
5 | "lint": "eslint --ext .js,.ts .",
6 | "build": "tsc",
7 | "serve": "yarn build && firebase emulators:start --only functions",
8 | "shell": "yarn build && firebase functions:shell",
9 | "start": "yarn shell",
10 | "deploy": "firebase deploy --only functions",
11 | "logs": "firebase functions:log"
12 | },
13 | "main": "lib/index.js",
14 | "dependencies": {
15 | "axios": "^0.27.2",
16 | "firebase-admin": "^9.2.0",
17 | "firebase-functions": "^3.11.0"
18 | },
19 | "devDependencies": {
20 | "eslint": "^7.6.0",
21 | "firebase-functions-test": "^0.2.0",
22 | "typescript": "^4.5.3",
23 | "config": "*"
24 | },
25 | "private": true
26 | }
27 |
--------------------------------------------------------------------------------
/apps/firebase-functions/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable import/prefer-default-export */
16 | import * as functions from 'firebase-functions'
17 | import axios from 'axios'
18 |
19 | export const createDBUser = functions
20 | .runWith({
21 | secrets: ['WEBHOOK_SECRET'],
22 | })
23 | .auth.user()
24 | .onCreate(async user => {
25 | try {
26 | if (!user) throw new Error('User is null')
27 | const data = JSON.stringify(user)
28 |
29 | const url = 'https://alpha.incredible.dev/api/webhook/new-user'
30 | const secret = process.env.WEBHOOK_SECRET
31 |
32 | if (!secret) throw new Error("Invalid ENV's provided")
33 | await axios.post(url, data, {
34 | headers: {
35 | 'Content-Type': 'application/json',
36 | 'x-secret': secret,
37 | },
38 | })
39 | } catch (e) {
40 | // Sentry.captureException(e)
41 | console.error(e)
42 | }
43 | })
44 |
--------------------------------------------------------------------------------
/apps/firebase-functions/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "noImplicitReturns": true,
5 | "noUnusedLocals": true,
6 | "outDir": "lib",
7 | "sourceMap": true,
8 | "strict": true,
9 | "target": "es2017"
10 | },
11 | "compileOnSave": true,
12 | "include": ["src"]
13 | }
14 |
--------------------------------------------------------------------------------
/apps/hocuspocus/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintNode = require('config/eslint-node.js')
2 |
3 | module.exports = {
4 | ...eslintNode,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | sourceType: 'module',
9 | ecmaVersion: 2020,
10 | },
11 | }
12 |
--------------------------------------------------------------------------------
/apps/hocuspocus/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hocuspocus",
3 | "version": "0.0.0",
4 | "description": "A backend for the tiptap editor",
5 | "license": "MIT",
6 | "scripts": {
7 | "build": "tsc",
8 | "start": "tsc && node dist/app.js",
9 | "lint": "eslint ./**/*.ts* --fix",
10 | "dev": "nodemon --watch './**/*.ts' --exec 'ts-node' src/app.ts"
11 | },
12 | "engines": {
13 | "npm": ">=7.0.0",
14 | "node": ">=14.0.0"
15 | },
16 | "dependencies": {
17 | "@hocuspocus/extension-database": "^1.0.0-alpha.17",
18 | "@hocuspocus/extension-logger": "^1.0.0-alpha.76",
19 | "@hocuspocus/extension-redis": "^1.0.0-alpha.65",
20 | "@hocuspocus/server": "^1.0.0-alpha.103",
21 | "@hocuspocus/transformer": "^1.0.0-alpha.23",
22 | "@sentry/node": "^7.1.1",
23 | "@sentry/tracing": "^7.1.1",
24 | "@tiptap/core": "^2.0.0-beta.182",
25 | "axios": "^0.27.2",
26 | "dotenv": "^16.0.1",
27 | "nanoid": "^3.1.23",
28 | "redis": "^4.1.0"
29 | },
30 | "devDependencies": {
31 | "@types/node": "^17.0.41",
32 | "config": "*",
33 | "eslint": "^8.17.0",
34 | "nodemon": "^2.0.16",
35 | "ts-node": "^10.8.1",
36 | "typescript": "^4.7.3"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/apps/hocuspocus/src/utils/logger.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import * as Sentry from '@sentry/node'
16 |
17 | const now = () => new Date().toISOString()
18 |
19 | class Logger {
20 | static log(message: string) {
21 | console.log(`[${now()}] ${message}`)
22 | }
23 |
24 | static error(message: string, context?: any) {
25 | Sentry.captureException(new Error(message), {
26 | contexts: context?.invocationId
27 | ? {
28 | invocationId: context.invocationId,
29 | }
30 | : undefined,
31 | user: context?.user
32 | ? {
33 | id: context.user.id,
34 | email: context.user.email,
35 | }
36 | : undefined,
37 | })
38 | console.error(`[${now()}] ${message}`)
39 | }
40 | }
41 |
42 | export default Logger
43 |
--------------------------------------------------------------------------------
/apps/hocuspocus/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-base.json",
3 | "compilerOptions": {
4 | "lib": ["ES2015"],
5 | "module": "CommonJS",
6 | "outDir": "./dist",
7 | "rootDir": "./src"
8 | },
9 | "exclude": ["node_modules"],
10 | "include": ["src"]
11 | }
12 |
--------------------------------------------------------------------------------
/apps/media-convert/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parserOptions: {
3 | ecmaVersion: 'latest',
4 | },
5 | env: {
6 | es6: true,
7 | },
8 | }
9 |
--------------------------------------------------------------------------------
/apps/media-convert/index.js:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const { CompleteHandler } = require('./utils.js')
16 |
17 | exports.handler = async event => {
18 | if (event.detail.queue !== process.env.MEDIA_QUEUE_ARN) {
19 | console.log('Invalid queue event. Skipping. eventdata = ', event)
20 | return
21 | }
22 |
23 | switch (event.detail.status) {
24 | case 'INPUT_INFORMATION':
25 | console.log(
26 | 'jobId:' + event.detail.jobId + ' Transcoder has read the input info'
27 | )
28 | break
29 |
30 | case 'PROGRESSING':
31 | console.log('jobId:' + event.detail.jobId + ' progressing .... ')
32 | break
33 |
34 | case 'COMPLETE':
35 | console.log(
36 | 'jobId:' + event.detail.jobId + ' successfully completed job.'
37 | )
38 |
39 | console.log('Detail : ', event.detail, '\t type = ', typeof event.detail)
40 | await CompleteHandler(event.detail.userMetadata)
41 | break
42 |
43 | case 'ERROR':
44 | console.log('jobId:' + event.detail.jobId + 'ERROR: ', event)
45 | break
46 | }
47 |
48 | return
49 | }
50 |
--------------------------------------------------------------------------------
/apps/media-convert/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mediaconvert",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "Ashwin.M.S",
10 | "license": "ISC",
11 | "dependencies": {
12 | "node-fetch": "^2.6.1"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/apps/webfront/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ...require('config/eslint-next.js'),
3 | parserOptions: {
4 | tsconfigRootDir: __dirname,
5 | project: './tsconfig.json',
6 | },
7 | }
8 |
--------------------------------------------------------------------------------
/apps/webfront/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started
2 |
3 | Run the development server:
4 |
5 | ```bash
6 | yarn dev
7 | ```
8 |
9 | ## Initializing tests
10 |
11 | ```bash
12 | yarn workspace webfront install -D jest @types/jest ts-jest
13 | cd apps/webfront
14 | yarn ts-jest config:init
15 | ```
16 |
17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18 |
--------------------------------------------------------------------------------
/apps/webfront/jest.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2 | module.exports = {
3 | preset: 'ts-jest',
4 | testEnvironment: 'node',
5 | testPathIgnorePatterns: ['.next/', 'node_modules/'],
6 | testMatch: ['**/**/*.test.ts'],
7 | verbose: true,
8 | forceExit: true,
9 | detectOpenHandles: true,
10 | moduleFileExtensions: ['ts', 'js'],
11 | moduleNameMapper: {
12 | 'src/(.*)': '/src/$1',
13 | },
14 | }
15 |
--------------------------------------------------------------------------------
/apps/webfront/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/apps/webfront/next.config.js:
--------------------------------------------------------------------------------
1 | const withTM = require('next-transpile-modules')([
2 | 'ui',
3 | 'editor',
4 | 'icanvas',
5 | 'utils',
6 | 'server',
7 | 'prisma-orm',
8 | '@vime/core',
9 | '@vime/react',
10 | ])
11 |
12 | module.exports = withTM({
13 | reactStrictMode: true,
14 | images: {
15 | domains: [
16 | 'lh3.googleusercontent.com',
17 | 'cdn-staging.incredible.dev',
18 | 'cdn.incredible.dev',
19 | ],
20 | },
21 | webpack(config) {
22 | config.module.rules.push({
23 | test: /\.svg$/,
24 | use: ['@svgr/webpack'],
25 | })
26 |
27 | return config
28 | },
29 |
30 | env: {
31 | NEXT_PUBLIC_DEPLOY_ENV: process.env.NEXT_PUBLIC_DEPLOY_ENV,
32 | NEXT_PUBLIC_API_ENDPOINT: process.env.NEXT_PUBLIC_API_ENDPOINT,
33 | NEXT_PUBLIC_PUBLIC_URL: process.env.NEXT_PUBLIC_PUBLIC_URL,
34 | NEXT_PUBLIC_CDN_URL: process.env.NEXT_PUBLIC_CDN_URL,
35 | NEXT_PUBLIC_EMBED_PLAYER_BASE_URL:
36 | process.env.NEXT_PUBLIC_EMBED_PLAYER_BASE_URL,
37 | NEXT_PUBLIC_HOCUSPOCUS_SERVER: process.env.NEXT_PUBLIC_HOCUSPOCUS_SERVER,
38 | NEXT_PUBLIC_GIPHY_API_KEY: process.env.NEXT_PUBLIC_GIPHY_API_KEY,
39 | NEXT_PUBLIC_GOOGLE_FONTS_API_KEY:
40 | process.env.NEXT_PUBLIC_GOOGLE_FONTS_API_KEY,
41 | NEXT_PUBLIC_AGORA_APP_ID: process.env.NEXT_PUBLIC_AGORA_APP_ID,
42 | NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY:
43 | process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY,
44 | NEXT_PUBLIC_LOGROCKET_APP_ID: process.env.NEXT_PUBLIC_LOGROCKET_APP_ID,
45 | NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
46 | NEXT_PUBLIC_GA_TRACKING_CODE: process.env.NEXT_PUBLIC_GA_TRACKING_CODE,
47 | NEXT_PUBLIC_SEGMENT_WATCH_ID: process.env.NEXT_PUBLIC_SEGMENT_WATCH_ID,
48 | TIPTAP_PRO_TOKEN: process.env.TIPTAP_PRO_TOKEN,
49 | NEXT_PUBLIC_FIREBASE_CONFIG: process.env.NEXT_PUBLIC_FIREBASE_CONFIG,
50 | FIREBASE_SERVICE_CONFIG: process.env.FIREBASE_SERVICE_CONFIG,
51 | COOKIE_DOMAIN: process.env.COOKIE_DOMAIN,
52 | },
53 | })
54 |
--------------------------------------------------------------------------------
/apps/webfront/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/apps/webfront/public/card_fallback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/card_fallback.png
--------------------------------------------------------------------------------
/apps/webfront/public/dp_fallback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/dp_fallback.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/android-chrome-192x192.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/android-chrome-512x512.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/apple-touch-icon.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/browserconfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | #ffffff
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/favicon-16x16.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/favicon-32x32.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/favicon.ico
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/favicons/mstile-150x150.png
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/safari-pinned-tab.svg:
--------------------------------------------------------------------------------
1 |
2 |
4 |
32 |
--------------------------------------------------------------------------------
/apps/webfront/public/favicons/site.webmanifest:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Incredible",
3 | "short_name": "Incredible",
4 | "icons": [
5 | {
6 | "src": "/assets/favicons/android-chrome-192x192.png?v=005",
7 | "sizes": "192x192",
8 | "type": "image/png"
9 | },
10 | {
11 | "src": "/assets/favicons/android-chrome-512x512.png?v=005",
12 | "sizes": "512x512",
13 | "type": "image/png"
14 | }
15 | ],
16 | "theme_color": "#ffffff",
17 | "background_color": "#ffffff",
18 | "display": "standalone"
19 | }
20 |
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gilroy/gilroy-bold-latin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gilroy/gilroy-bold-latin.woff2
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gilroy/gilroy-extrabold-latin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gilroy/gilroy-extrabold-latin.woff2
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gilroy/gilroy-regular-latin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gilroy/gilroy-regular-latin.woff2
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gilroy/gilroy-semibold-latin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gilroy/gilroy-semibold-latin.woff2
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gotham/GothamBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gotham/GothamBold.ttf
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Gotham/GothamLight.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Gotham/GothamLight.ttf
--------------------------------------------------------------------------------
/apps/webfront/public/fonts/Inter/inter-var-latin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/fonts/Inter/inter-var-latin.woff2
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person1.png
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person2.png
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person3.png
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person4.png
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person5.png
--------------------------------------------------------------------------------
/apps/webfront/public/onboarding/person6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/apps/webfront/public/onboarding/person6.png
--------------------------------------------------------------------------------
/apps/webfront/sample.env:
--------------------------------------------------------------------------------
1 | NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY=""
2 | NEXT_PUBLIC_EMBED_PLAYER_BASE_URL="http://localhost:3001"
3 | NEXT_PUBLIC_GOOGLE_FONTS_API_KEY=""
4 | NEXT_PUBLIC_HOCUSPOCUS_SERVER=""
5 | NEXT_PUBLIC_FIREBASE_CONFIG=""
6 | NEXT_PUBLIC_GIPHY_API_KEY=""
7 | NEXT_PUBLIC_TOKENIZE_ENDPOINT="http://localhost:8080/color-codes"
8 | NEXT_PUBLIC_API_ENDPOINT="http://localhost:3000/api"
9 | NEXT_PUBLIC_PUBLIC_URL="http://localhost:3000"
10 | NEXT_PUBLIC_AGORA_APP_ID=""
11 | NEXT_PUBLIC_DEPLOY_ENV=""
12 | NEXT_PUBLIC_CDN_URL=""
13 | ENCRYPTION_KEY=""
14 | NPM_RC=""
15 | IV=""
16 | ENV_ENCRYPTION_ALGORITHM=""
17 | DOPPLER_TOKEN=""
18 | DATABASE_URL=""
19 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/core/CookieBanner.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { cx } from '@emotion/css'
16 | import { useState } from 'react'
17 | import Check from 'svg/Check.svg'
18 | import { IconButton } from 'ui/src'
19 |
20 | const CookieBanner = () => {
21 | const [show, setShow] = useState(true)
22 |
23 | return (
24 |
29 |
30 |
31 | By visiting our website, you agree to our 🍪 cookie policy
32 |
42 | )
43 | }
44 |
45 | export default CookieBanner
46 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/core/CoreLayout.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import Footer from './Footer'
16 | import Header from './Header'
17 |
18 | const CoreLayout = ({ children }: any) => (
19 | <>
20 |
21 |
22 | {children}
23 |
24 |
25 | >
26 | )
27 |
28 | export default CoreLayout
29 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/core/Header.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import NextLink from 'next/link'
16 | import { FaGithub } from 'react-icons/fa'
17 | import Logo from 'svg/Logo.svg'
18 | import { Button } from 'ui/src'
19 |
20 | const Header = () => (
21 |
22 |
23 |
24 |
25 |
26 |
27 | }
33 | >
34 | Star Us
35 |
36 |
37 |
38 | )
39 |
40 | export default Header
41 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/dashboard/SeriesTile.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { css, cx } from '@emotion/css'
16 | import { format } from 'date-fns'
17 | import Link from 'next/link'
18 | import React from 'react'
19 | import { inferQueryOutput } from 'src/server/trpc'
20 |
21 | const clamp = css`
22 | display: -webkit-box;
23 | -webkit-line-clamp: 2;
24 | -webkit-box-orient: vertical;
25 | overflow: hidden;
26 | `
27 |
28 | const SeriesTile = ({
29 | series,
30 | }: {
31 | series: inferQueryOutput<'series.dashboard'>['series'][number]
32 | }) => (
33 |
34 |
35 |
36 |
42 | {series.name}
43 |
44 |
47 |
48 |
49 |
50 | )
51 |
52 | export default SeriesTile
53 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/flick/preview/mode/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { BlockView } from 'utils/src'
16 | import CodeBlockMode from './CodeBlockMode'
17 | import ImageBlockMode from './ImageBlockMode'
18 | import ListBlockMode from './ListBlockMode'
19 | import VideoBlockMode from './VideoBlockMode'
20 |
21 | const ModeSelector = ({
22 | view,
23 | updateView,
24 | }: {
25 | view: BlockView | undefined
26 | updateView: (view: BlockView) => void
27 | }) => {
28 | if (!view) return null
29 |
30 | return (() => {
31 | switch (view.type) {
32 | case 'codeBlock':
33 | return
34 | case 'imageBlock':
35 | return
36 | case 'videoBlock':
37 | return
38 | case 'listBlock':
39 | return
40 | default:
41 | return null
42 | }
43 | })()
44 | }
45 |
46 | export default ModeSelector
47 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/flick/studio/Countdown.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useEffect, useState } from 'react'
16 | import { useRecoilValue } from 'recoil'
17 | import { StudioState, studioStateAtom } from 'src/stores/studio.store'
18 | import { Heading } from 'ui/src'
19 |
20 | const Countdown = ({
21 | updateState,
22 | }: {
23 | updateState: (value: StudioState) => void
24 | }) => {
25 | const state = useRecoilValue(studioStateAtom)
26 | const [timer, setTimer] = useState(3)
27 |
28 | useEffect(() => {
29 | if (state === 'countDown') {
30 | if (timer === 0) {
31 | updateState('recording')
32 | } else {
33 | setTimeout(() => {
34 | setTimer(timer - 1)
35 | }, 1000)
36 | }
37 | }
38 | if (state === 'ready' || state === 'resumed') setTimer(3)
39 | }, [state, timer])
40 |
41 | return timer > 0 && state === 'countDown' ? (
42 |
43 | {timer}
44 |
45 | ) : null
46 | }
47 |
48 | export default Countdown
49 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/flick/studio/Timer.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import React, { useEffect, useState } from 'react'
16 | import { useRecoilValue } from 'recoil'
17 | import { studioStateAtom } from 'src/stores/studio.store'
18 | import { Text } from 'ui/src'
19 | import useInterval from 'use-interval'
20 |
21 | const formatTime = (timer: number) => {
22 | const getSeconds = `0${timer % 60}`.slice(-2)
23 | const minutes = `${Math.floor(timer / 60)}`
24 | const getMinutes = `0${+minutes % 60}`.slice(-2)
25 |
26 | return `${getMinutes}:${getSeconds}`
27 | }
28 |
29 | // type TimerState = 'noTarget' | 'onTime' | 'overtime' | 'closeShave'
30 |
31 | const Timer = () => {
32 | const state = useRecoilValue(studioStateAtom)
33 | const [timer, setTimer] = useState(0)
34 | const [isActive, setIsActive] = useState(false)
35 |
36 | useInterval(
37 | () => {
38 | setTimer(t => t + 1)
39 | },
40 | isActive ? 1000 : null,
41 | true
42 | )
43 |
44 | useEffect(() => {
45 | if (state === 'recording') {
46 | setTimer(0)
47 | setIsActive(true)
48 | }
49 | if (state === 'stopRecording') {
50 | setTimer(0)
51 | setIsActive(false)
52 | }
53 | }, [state])
54 |
55 | return (
56 |
57 | {formatTime(timer)}
58 |
59 | )
60 | }
61 |
62 | export default Timer
63 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/legal/Content.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const Content = ({ content }: { content: string }) => (
16 |
17 |
22 |
23 | )
24 |
25 | export default Content
26 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/legal/HeroText.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import Pattern from './Pattern'
16 |
17 | const Hero = ({
18 | title,
19 | description,
20 | }: {
21 | title: string
22 | description: string
23 | }) => (
24 |
25 |
26 |
27 | {title}
28 |
29 |
30 | {description}
31 |
32 |
33 |
34 |
35 |
36 |
37 | )
38 |
39 | export default Hero
40 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/notifications/NotificationMessage.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { Text } from 'ui/src'
16 | import { inferQueryOutput } from '../../server/trpc'
17 |
18 | const NotificationMessage = ({
19 | notification,
20 | }: {
21 | notification: inferQueryOutput<'user.notifications'>['notifications'][number]
22 | }) => {
23 | const { message } = notification
24 | const regex = /%(.*?)%/g
25 | return (
26 | $1'
33 | ),
34 | }}
35 | />
36 | )
37 | }
38 |
39 | export default NotificationMessage
40 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/onboarding/types.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { createContext } from 'react'
16 |
17 | export enum OnBoardingScreens {
18 | MainDetails = 'main-details',
19 | PersonalDetails = 'personal-details',
20 | Upload = 'upload',
21 | }
22 |
23 | export interface OnBoardingProps {
24 | name: string
25 | username: string
26 | designation: string
27 | organization: string
28 | profilePicture: string
29 | }
30 |
31 | export const OnBoardingContext = createContext(
32 | {} as {
33 | details: OnBoardingProps
34 | activeScreen: OnBoardingScreens
35 | loading: boolean
36 | setActiveScreen: (screen: OnBoardingScreens) => void
37 | setDetails: (details: OnBoardingProps) => void
38 | handleOnBoarding: () => Promise
39 | }
40 | )
41 |
--------------------------------------------------------------------------------
/apps/webfront/src/components/series/SeriesActionButton.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/jsx-props-no-spreading */
16 | import { HTMLAttributes } from 'react'
17 |
18 | import { cx } from '@emotion/css'
19 |
20 | const SeriesActionButton = ({
21 | icon,
22 | number,
23 | className,
24 | children,
25 | disabled,
26 | ...rest
27 | }: {
28 | icon?: JSX.Element
29 | number?: number
30 | disabled?: boolean
31 | } & HTMLAttributes) => (
32 |
54 | )
55 |
56 | export default SeriesActionButton
57 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/500.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import Link from 'next/link'
16 | import { useEffect } from 'react'
17 | import Container from 'src/components/core/Container'
18 | import usePush from 'src/utils/hooks/usePush'
19 | import { useUser } from 'src/utils/providers/auth'
20 |
21 | const ErrorPage = () => {
22 | const push = usePush()
23 | const { user } = useUser()
24 |
25 | useEffect(() => {
26 | if (user) {
27 | if (user.onboarded) push('/dashboard')
28 | else push('/onboarding')
29 | }
30 | }, [user, push])
31 |
32 | return (
33 |
34 |
35 |
36 |
37 |
38 | 500
39 |
40 |
41 | Sorry, something went wrong
42 |
43 |
44 |
45 |
46 | Go home
47 |
48 |
49 |
50 |
51 |
52 |
53 | )
54 | }
55 |
56 | export default ErrorPage
57 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/api/logout.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable no-underscore-dangle */
16 | import Cors from 'cors'
17 | import admin, { auth } from 'firebase-admin'
18 | import { NextApiRequest, NextApiResponse } from 'next'
19 | import serverEnvs from 'server/utils/env'
20 | import initMiddleware from 'src/utils/helpers/initMiddleware'
21 | import setCookie from 'src/utils/helpers/setCookie'
22 |
23 | const cors = initMiddleware(
24 | Cors({
25 | origin: true,
26 | credentials: true,
27 | })
28 | )
29 |
30 | const logout = async (req: NextApiRequest, res: NextApiResponse) => {
31 | try {
32 | await cors(req, res)
33 | if (!admin.apps.length) {
34 | admin.initializeApp({
35 | credential: admin.credential.cert(
36 | JSON.parse(serverEnvs.FIREBASE_SERVICE_CONFIG as string)
37 | ),
38 | })
39 | }
40 | const sessionCookie = req.cookies?.__session || ''
41 | // If session Cookie is present revoke it
42 | if (sessionCookie) {
43 | const decodedClaims = await auth().verifySessionCookie(
44 | sessionCookie,
45 | true
46 | )
47 | await auth().revokeRefreshTokens(decodedClaims.sub)
48 | }
49 | // clear session cookie on the client
50 | setCookie(res, '__session', '', {
51 | maxAge: -1,
52 | })
53 | return res.status(200).send('Logged out')
54 | } catch (e) {
55 | const error = e as Error
56 | return res.status(501).json({ success: false, message: error.message })
57 | }
58 | }
59 |
60 | export default logout
61 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/api/trpc/[trpc].ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import * as trpcNext from '@trpc/server/adapters/next'
16 | import appRouter from 'server/routes/route'
17 | import { createContext } from 'server/createContext'
18 |
19 | // export API handler
20 | export default trpcNext.createNextApiHandler({
21 | router: appRouter,
22 | createContext,
23 | onError({ error }) {
24 | // TODO: Add sentry
25 | console.error(error)
26 | },
27 | })
28 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/api/webhook/complete-recording.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { NextApiRequest, NextApiResponse } from 'next'
16 | import prisma from 'prisma-orm/prisma'
17 | import serverEnvs from 'server/utils/env'
18 | import { RecordingStatusEnum } from 'utils/src/enums'
19 |
20 | type Payload = {
21 | recordingId: string
22 | flickId: string
23 | outputKey: string
24 | orientation?: string
25 | }
26 |
27 | const completeRecording = async (req: NextApiRequest, res: NextApiResponse) => {
28 | if (req.headers['x-secret'] !== serverEnvs.WEBHOOK_SECRET) {
29 | res.status(401).send({})
30 | return
31 | }
32 |
33 | const { recordingId, outputKey } = req.body as Payload
34 | try {
35 | await prisma.recording.update({
36 | where: {
37 | id: recordingId,
38 | },
39 | data: {
40 | url: outputKey,
41 | status: RecordingStatusEnum.Completed,
42 | },
43 | })
44 | res.status(200).send({})
45 | } catch (e) {
46 | // TODO: Sentry.captureException(e)
47 | console.error(e)
48 | res.status(500).send({})
49 | }
50 | }
51 |
52 | export default completeRecording
53 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/api/webhook/editor-update.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { NextApiRequest, NextApiResponse } from 'next'
16 | import prisma from 'prisma-orm/prisma'
17 | import serverEnvs from 'server/utils/env'
18 |
19 | type Payload = {
20 | fragmentId: string
21 | encodedEditorValue: string
22 | editorState: string
23 | }
24 |
25 | const editorUpdate = async (req: NextApiRequest, res: NextApiResponse) => {
26 | if (req.headers['x-secret'] !== serverEnvs.WEBHOOK_SECRET) {
27 | res.status(401).send({})
28 | return
29 | }
30 |
31 | const { fragmentId, encodedEditorValue, editorState } = req.body as Payload
32 | try {
33 | await prisma.fragment.update({
34 | where: {
35 | id: fragmentId,
36 | },
37 | data: {
38 | encodedEditorValue,
39 | editorState,
40 | },
41 | })
42 | res.status(200).send({})
43 | } catch (e) {
44 | console.error(e)
45 | res.status(500).send({})
46 | }
47 | }
48 |
49 | export default editorUpdate
50 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useRouter } from 'next/router'
16 | import { useEffect } from 'react'
17 | import Container from 'src/components/core/Container'
18 | import CookieBanner from 'src/components/core/CookieBanner'
19 | import CoreLayout from 'src/components/core/CoreLayout'
20 | import Hero from 'src/components/core/Hero'
21 | import { useUser } from 'src/utils/providers/auth'
22 |
23 | const Web = () => {
24 | const { user, loadingUser } = useUser()
25 | const { replace } = useRouter()
26 |
27 | useEffect(() => {
28 | if (!loadingUser && user) {
29 | if (user.onboarded) {
30 | replace('/dashboard')
31 | } else {
32 | replace('/onboarding')
33 | }
34 | }
35 | }, [user, loadingUser, replace])
36 |
37 | return (
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | )
52 | }
53 |
54 | export default Web
55 |
--------------------------------------------------------------------------------
/apps/webfront/src/pages/onboarding/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useRouter } from 'next/router'
16 | import { useEffect } from 'react'
17 | import OnBoarding from 'src/components/onboarding/OnBoarding'
18 | import requireAuth from 'src/utils/helpers/requireAuth'
19 | import { useUser } from 'src/utils/providers/auth'
20 | import { ScreenState } from 'ui/src'
21 |
22 | const OnboardingPage = () => {
23 | const { user, loadingUser } = useUser()
24 | const router = useRouter()
25 |
26 | useEffect(() => {
27 | if (user && user.onboarded) {
28 | router.push('/dashboard')
29 | }
30 | }, [user])
31 |
32 | if (!user || loadingUser) {
33 | return
34 | }
35 |
36 | return user && user.onboarded ? (
37 |
38 | ) : (
39 |
40 | )
41 | }
42 |
43 | export const getServerSideProps = requireAuth()(async () => ({
44 | props: {},
45 | }))
46 |
47 | export default OnboardingPage
48 |
--------------------------------------------------------------------------------
/apps/webfront/src/server/trpc.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable @typescript-eslint/naming-convention */
16 | import { createReactQueryHooks } from '@trpc/react'
17 | import type { inferProcedureInput, inferProcedureOutput } from '@trpc/server'
18 | import { AppRouter } from 'server/routes/route'
19 |
20 | const trpc = createReactQueryHooks()
21 |
22 | /**
23 | * This is a helper method to infer the output of a query resolver
24 | * @example type HelloOutput = inferQueryOutput<'hello'>
25 | */
26 | export type inferQueryOutput<
27 | TRouteKey extends keyof AppRouter['_def']['queries']
28 | > = inferProcedureOutput
29 |
30 | export type inferQueryInput<
31 | TRouteKey extends keyof AppRouter['_def']['queries']
32 | > = inferProcedureInput
33 |
34 | export type inferMutationOutput<
35 | TRouteKey extends keyof AppRouter['_def']['mutations']
36 | > = inferProcedureOutput
37 |
38 | export type inferMutationInput<
39 | TRouteKey extends keyof AppRouter['_def']['mutations']
40 | > = inferProcedureInput
41 |
42 | export default trpc
43 |
--------------------------------------------------------------------------------
/apps/webfront/src/types/env.d.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | declare global {
16 | namespace NodeJS {
17 | interface ProcessEnv {
18 | NEXT_PUBLIC_DEPLOY_ENV: string
19 | NEXT_PUBLIC_API_ENDPOINT: string
20 | NEXT_PUBLIC_PUBLIC_URL: string
21 | NEXT_PUBLIC_CDN_URL: string
22 | NEXT_PUBLIC_EMBED_PLAYER_BASE_URL: string
23 | NEXT_PUBLIC_HOCUSPOCUS_SERVER: string
24 | NEXT_PUBLIC_GIPHY_API_KEY: string
25 | NEXT_PUBLIC_GOOGLE_FONTS_API_KEY: string
26 | NEXT_PUBLIC_AGORA_APP_ID: string
27 | NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY: string
28 | NEXT_PUBLIC_LOGROCKET_APP_ID: string
29 | NEXT_PUBLIC_SENTRY_DSN: string
30 | NEXT_PUBLIC_GA_TRACKING_CODE: string
31 | NEXT_PUBLIC_SEGMENT_WATCH_ID: string
32 | NEXT_PUBLIC_HASURA_SERVER: string
33 | NEXT_PUBLIC_HASURA_WS_SERVER: string
34 | NEXT_PUBLIC_HASURA_REST: string
35 | TIPTAP_PRO_TOKEN: string
36 | HASURA_ADMIN_SECRET: string
37 | CUSTOMERIO_API_KEY: string
38 | CUSTOMERIO_SITE_ID: string
39 | CUSTOMERIO_APP_ID: string
40 | NEXT_PUBLIC_FIREBASE_CONFIG: string
41 | FIREBASE_SERVICE_CONFIG: string
42 | COOKIE_DOMAIN: string
43 | NEXT_PUBLIC_BASE_URL: string
44 | }
45 | }
46 | }
47 |
48 | export {}
49 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/helpers/initMiddleware.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { NextApiRequest, NextApiResponse } from 'next'
16 |
17 | const initMiddleware =
18 | (middleware: any) => (req: NextApiRequest, res: NextApiResponse) =>
19 | new Promise((resolve, reject) => {
20 | middleware(req, res, (result: any) => {
21 | if (result instanceof Error) {
22 | return reject(result)
23 | }
24 | return resolve(result)
25 | })
26 | })
27 |
28 | export default initMiddleware
29 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/helpers/mdToHtml.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import matter from 'gray-matter'
16 | import { remark } from 'remark'
17 | import html from 'remark-html'
18 | import { promises as fs } from 'fs'
19 | import path from 'path'
20 |
21 | export default async function markdownToHtml(markdown: string) {
22 | const result = await remark().use(html).process(markdown)
23 | return result.toString()
24 | }
25 |
26 | export async function getPostBySlug(slug: string, fields: string[] = []) {
27 | const realSlug = slug.replace(/\.md$/, '')
28 | const mdDirectory = path.join(process.cwd(), 'data', 'legal')
29 | const fileContents = await fs.readFile(
30 | `${mdDirectory}/${realSlug}.md`,
31 | 'utf8'
32 | )
33 | const { data, content } = matter(fileContents)
34 |
35 | type Items = {
36 | [key: string]: string
37 | }
38 |
39 | const items: Items = {}
40 |
41 | // Ensure only the minimal needed data is exposed
42 | fields.forEach(field => {
43 | if (field === 'slug') {
44 | items[field] = realSlug
45 | }
46 | if (field === 'content') {
47 | items[field] = content
48 | }
49 | if (field === 'date') {
50 | items[field] = JSON.stringify(data.date)
51 | } else if (typeof data[field] !== 'undefined') {
52 | items[field] = data[field]
53 | }
54 | })
55 |
56 | return items
57 | }
58 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/helpers/setCookie.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { serialize, CookieSerializeOptions } from 'cookie'
16 | import { NextApiResponse } from 'next'
17 |
18 | const setCookie = (
19 | res: NextApiResponse,
20 | name: string,
21 | value: unknown,
22 | options: CookieSerializeOptions = {}
23 | ) => {
24 | const stringValue =
25 | typeof value === 'object' ? `j:${JSON.stringify(value)}` : String(value)
26 |
27 | res.setHeader('Set-Cookie', serialize(name, stringValue, options))
28 | }
29 |
30 | export default setCookie
31 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/hooks/useBlock.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useCallback, useEffect, useState } from 'react'
16 | import { BlockProperties } from 'utils/src'
17 | import { useMap, useRoom } from '../liveblocks.config'
18 |
19 | const useBlock = (fragmentId: string, blockId: string) => {
20 | const blocks = useMap('viewConfig')?.get(fragmentId)?.get('blocks')
21 | const block = useMap('viewConfig')
22 | ?.get(fragmentId)
23 | ?.get('blocks')
24 | ?.get(blockId)
25 |
26 | const [blockProperties, setBlockProperties] = useState<
27 | BlockProperties | undefined
28 | >()
29 |
30 | useEffect(() => {
31 | if (block) {
32 | setBlockProperties(block)
33 | }
34 | }, [block])
35 |
36 | const room = useRoom()
37 |
38 | useEffect(() => {
39 | let unsubscribe: any
40 | if (blocks && !unsubscribe) {
41 | unsubscribe = room.subscribe(
42 | blocks,
43 | () => {
44 | setBlockProperties(blocks?.get(blockId))
45 | },
46 | { isDeep: true }
47 | )
48 | }
49 | return () => {
50 | unsubscribe?.()
51 | }
52 | }, [blocks, block, blockId, room])
53 |
54 | const updateBlockProperties = useCallback(
55 | (properties: BlockProperties) => {
56 | blocks?.set(blockId, properties)
57 | },
58 | [blockId, blocks]
59 | )
60 |
61 | return { blockProperties, updateBlockProperties }
62 | }
63 |
64 | export default useBlock
65 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/hooks/useDidUpdateEffect.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react-hooks/exhaustive-deps */
16 | import { useRef, useEffect } from 'react'
17 |
18 | function useDidUpdateEffect(fn: any, inputs: any) {
19 | const didMountRef = useRef(false)
20 |
21 | // eslint-disable-next-line consistent-return
22 | useEffect(() => {
23 | if (didMountRef.current) return fn()
24 | didMountRef.current = true
25 | }, inputs)
26 | }
27 |
28 | export default useDidUpdateEffect
29 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/hooks/usePush.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useRouter } from 'next/router'
16 | import type { NextRouter } from 'next/router'
17 | import { useRef, useState } from 'react'
18 |
19 | // A safe to use hook to include router.push() as a dependency to a useEffect
20 | export default function usePush(): NextRouter['push'] {
21 | const router = useRouter()
22 | const routerRef = useRef(router)
23 |
24 | routerRef.current = router
25 |
26 | const [{ push }] = useState>({
27 | push: path => routerRef.current.push(path),
28 | })
29 |
30 | return push
31 | }
32 |
--------------------------------------------------------------------------------
/apps/webfront/src/utils/hooks/useReplace.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { useRouter } from 'next/router'
16 | import type { NextRouter } from 'next/router'
17 | import { useRef, useState } from 'react'
18 |
19 | // A safe to use hook to include router.replace() as a dependency to a useEffect
20 | export default function useReplace(): NextRouter['replace'] {
21 | const router = useRouter()
22 | const routerRef = useRef(router)
23 |
24 | routerRef.current = router
25 |
26 | const [{ replace }] = useState>({
27 | replace: path => routerRef.current.replace(path),
28 | })
29 |
30 | return replace
31 | }
32 |
--------------------------------------------------------------------------------
/apps/webfront/svg/404.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/apps/webfront/svg/BrandIcon.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/apps/webfront/svg/BulletListStyle.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Check.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Discord.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Flick.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Linkedin.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Logomark.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/apps/webfront/svg/NumberListStyle.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/apps/webfront/svg/OutroFragment/discord.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/apps/webfront/svg/OutroFragment/linkedin.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/OutroFragment/twitter.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/apps/webfront/svg/OutroFragment/website.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/apps/webfront/svg/OutroFragment/youtube.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/apps/webfront/svg/RecordingScreen/CustomLayout.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/RecordingScreen/OnlyUserMedia.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/RecordingScreen/StartRecord.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/RecordingScreen/StopRecord.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/RecordingScreen/ThreeWaySwap.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Timeline.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/apps/webfront/svg/TransitionIcon.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Twitter.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/apps/webfront/svg/UserPlaceholder.svg:
--------------------------------------------------------------------------------
1 |
30 |
--------------------------------------------------------------------------------
/apps/webfront/svg/Youtube.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/apps/webfront/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('config/tailwind.config')
2 |
--------------------------------------------------------------------------------
/apps/webfront/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-next.json",
3 | "compilerOptions": {
4 | "baseUrl": ".",
5 | "strict": true,
6 | "disableSizeLimit": true,
7 | "declaration": false,
8 | "declarationMap": false,
9 | "skipLibCheck": true
10 | },
11 | "paths": {
12 | "@/*": ["./src/*"]
13 | },
14 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
15 | "exclude": ["node_modules"]
16 | }
17 |
--------------------------------------------------------------------------------
/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/assets/logo.png
--------------------------------------------------------------------------------
/assets/main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/assets/main.png
--------------------------------------------------------------------------------
/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | colorcodes:
4 | image: colorcodes
5 | ports:
6 | - "8080:3000"
7 | environment:
8 | - PORT=3000
9 | expose:
10 | - "8080"
11 |
12 | redis:
13 | image: redislabs/rejson
14 | ports:
15 | - "6379:6379"
16 | command: redis-server --requirepass redispwd
17 | expose:
18 | - "6379"
19 |
20 | minio:
21 | image: minio/minio
22 | ports:
23 | - "9000:9000"
24 | - "9001:9001"
25 | volumes:
26 | - minio_storage:/data
27 | environment:
28 | MINIO_ROOT_USER: incredible
29 | MINIO_ROOT_PASSWORD: SuperSecretRootPwd
30 | command: server --console-address ":9001" /data
31 |
32 | db:
33 | image: mysql:5.7
34 | restart: always
35 | environment:
36 | MYSQL_DATABASE: 'db'
37 | MYSQL_USER: 'user'
38 | MYSQL_PASSWORD: 'pwd123'
39 | MYSQL_ROOT_PASSWORD: 'pwd321'
40 | ports:
41 | - '3306:3306'
42 | expose:
43 | - '3306'
44 | volumes:
45 | - my-db:/var/lib/mysql
46 |
47 | volumes:
48 | my-db:
49 | minio_storage: {}
50 |
51 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "monorepo",
3 | "version": "0.0.0",
4 | "private": true,
5 | "workspaces": [
6 | "apps/*",
7 | "packages/*"
8 | ],
9 | "scripts": {
10 | "build": "turbo run build",
11 | "commit": "cz",
12 | "dev": "turbo run dev --parallel",
13 | "lint": "turbo run lint",
14 | "format": "prettier --write \"**/*.{ts,tsx,md,js,jsx}\"",
15 | "prepare": "husky install && turbo run prepare",
16 | "postinstall": "turbo run postinstall"
17 | },
18 | "devDependencies": {
19 | "commitizen": "^4.2.4",
20 | "cz-conventional-changelog": "^3.3.0",
21 | "husky": "^8.0.1",
22 | "lint-staged": "^13.0.2",
23 | "prettier": "latest",
24 | "ts-node": "^10.9.1",
25 | "turbo": "latest"
26 | },
27 | "resolutions": {
28 | "@types/react": "17.0.37"
29 | },
30 | "engines": {
31 | "npm": ">=7.0.0",
32 | "node": ">=14.0.0"
33 | },
34 | "lint-staged": {
35 | "apps/**/*.{js,ts,jsx,tsx}": [
36 | "eslint --fix"
37 | ],
38 | "packages/ui/**/*.{js,ts,jsx,tsx}": [
39 | "eslint --fix"
40 | ],
41 | "packages/editor/**/*.{js,ts,jsx,tsx}": [
42 | "eslint --fix"
43 | ],
44 | "packages/icanvas/**/*.{js,ts,jsx,tsx}": [
45 | "eslint --fix"
46 | ],
47 | "packages/prisma-orm/**/*.{js,ts,jsx,tsx}": [
48 | "eslint --fix"
49 | ],
50 | "packages/server/**/*.{js,ts,jsx,tsx}": [
51 | "eslint --fix"
52 | ],
53 | "packages/utils/**/*.{js,ts,jsx,tsx}": [
54 | "eslint --fix"
55 | ],
56 | "*.json": [
57 | "prettier --write"
58 | ]
59 | },
60 | "packageManager": "yarn@1.22.10"
61 | }
62 |
--------------------------------------------------------------------------------
/packages/config/eslint-next.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | node: true,
5 | },
6 | extends: [
7 | 'next',
8 | 'airbnb',
9 | 'airbnb-typescript',
10 | 'plugin:import/recommended',
11 | 'plugin:import/typescript',
12 | 'prettier',
13 | ],
14 | plugins: ['@typescript-eslint', 'import'],
15 | settings: {
16 | next: {
17 | rootDir: ['apps/*/', 'packages/*/'],
18 | },
19 | 'import/parsers': {
20 | '@typescript-eslint/parser': ['.ts', '.tsx'],
21 | },
22 | 'import/resolver': {
23 | typescript: {
24 | alwaysTryTypes: true,
25 | project: ['apps/*/tsconfig.json'],
26 | },
27 | },
28 | },
29 | rules: {
30 | // react
31 | 'react/function-component-definition': [
32 | 2,
33 | {
34 | namedComponents: 'arrow-function',
35 | },
36 | ],
37 | 'react/react-in-jsx-scope': 'off',
38 | 'react/require-default-props': 'off',
39 | 'react-hooks/exhaustive-deps': 0,
40 | 'react/jsx-props-no-spreading': 0,
41 | 'react/destructuring-assignment': 0,
42 | // next
43 | '@next/next/no-html-link-for-pages': 'off',
44 | },
45 | overrides: [
46 | {
47 | // 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
48 | env: {
49 | jest: true,
50 | },
51 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
52 | extends: ['plugin:testing-library/react', 'plugin:jest/recommended'],
53 | rules: {
54 | 'import/no-extraneous-dependencies': [
55 | 'off',
56 | { devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] },
57 | ],
58 | 'react-hooks/exhaustive-deps': [
59 | 'warn',
60 | {
61 | additionalHooks:
62 | '(useRecoilCallback|useRecoilTransaction_UNSTABLE)',
63 | },
64 | ],
65 | },
66 | },
67 | ],
68 | ignorePatterns: [
69 | '**/*.js',
70 | '**/*.json',
71 | 'node_modules',
72 | 'public',
73 | 'styles',
74 | '.next',
75 | 'coverage',
76 | 'dist',
77 | '.turbo',
78 | '**/*/graphql/generated.ts',
79 | '**/*/graphql/generated-ssr.ts',
80 | '**/*/graphql.schema.json',
81 | ],
82 | }
83 |
--------------------------------------------------------------------------------
/packages/config/eslint-node.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | node: true,
5 | },
6 | extends: [
7 | 'airbnb',
8 | 'airbnb-typescript',
9 | 'plugin:import/recommended',
10 | 'plugin:import/typescript',
11 | 'plugin:node/recommended',
12 | 'prettier',
13 | ],
14 | plugins: ['@typescript-eslint', 'import'],
15 | settings: {
16 | 'import/parsers': {
17 | '@typescript-eslint/parser': ['.ts', '.tsx'],
18 | },
19 | 'import/resolver': {
20 | typescript: {
21 | alwaysTryTypes: true,
22 | project: ['apps/*/tsconfig.json'],
23 | },
24 | },
25 | node: {
26 | tryExtensions: ['.js', '.json', '.node', '.ts', '.d.ts'],
27 | },
28 | },
29 | rules: {
30 | 'node/no-unsupported-features/es-syntax': [
31 | 'error',
32 | { ignores: ['modules'] },
33 | ],
34 | 'no-console': 'off',
35 | },
36 | overrides: [
37 | {
38 | // 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
39 | env: {
40 | jest: true,
41 | },
42 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
43 | extends: ['plugin:testing-library/react', 'plugin:jest/recommended'],
44 | rules: {
45 | 'import/no-extraneous-dependencies': [
46 | 'off',
47 | { devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] },
48 | ],
49 | },
50 | },
51 | ],
52 | ignorePatterns: [
53 | '**/*.js',
54 | '**/*.json',
55 | 'node_modules',
56 | 'public',
57 | 'styles',
58 | '.next',
59 | 'coverage',
60 | 'dist',
61 | '.turbo',
62 | '**/*/graphql/generated.ts',
63 | '**/*/graphql/generated-ssr.ts',
64 | '**/*/graphql.schema.json',
65 | ],
66 | }
67 |
--------------------------------------------------------------------------------
/packages/config/eslint-react.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es2021: true,
5 | },
6 | extends: [
7 | 'airbnb',
8 | 'airbnb-typescript',
9 | 'plugin:import/recommended',
10 | 'plugin:import/typescript',
11 | 'prettier',
12 | ],
13 | plugins: ['@typescript-eslint', 'import', 'react'],
14 | settings: {
15 | 'import/parsers': {
16 | '@typescript-eslint/parser': ['.ts', '.tsx'],
17 | },
18 | 'import/resolver': {
19 | typescript: {
20 | alwaysTryTypes: true,
21 | project: ['apps/*/tsconfig.json'],
22 | },
23 | },
24 | },
25 | rules: {
26 | // react
27 | 'react/function-component-definition': [
28 | 2,
29 | {
30 | namedComponents: 'arrow-function',
31 | },
32 | ],
33 | 'react/react-in-jsx-scope': 'off',
34 | },
35 | overrides: [
36 | {
37 | // 3) Now we enable eslint-plugin-testing-library rules or preset only for matching files!
38 | env: {
39 | jest: true,
40 | },
41 | files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
42 | extends: ['plugin:testing-library/react', 'plugin:jest/recommended'],
43 | rules: {
44 | 'import/no-extraneous-dependencies': [
45 | 'off',
46 | { devDependencies: ['**/?(*.)+(spec|test).[jt]s?(x)'] },
47 | ],
48 | },
49 | },
50 | ],
51 | ignorePatterns: [
52 | '**/*.js',
53 | '**/*.json',
54 | 'node_modules',
55 | 'public',
56 | 'styles',
57 | 'coverage',
58 | 'dist',
59 | '.turbo',
60 | ],
61 | }
62 |
--------------------------------------------------------------------------------
/packages/config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "config",
3 | "version": "0.0.0",
4 | "private": true,
5 | "main": "index.js",
6 | "files": [
7 | "eslint-next.js",
8 | "eslint-react.js",
9 | "eslint-node.js",
10 | "tailwind.config.js",
11 | "tsconfig-base.json",
12 | "tsconfig-next.json",
13 | "tsconfig-react.json"
14 | ],
15 | "dependencies": {
16 | "@typescript-eslint/eslint-plugin": "^5.7.0",
17 | "@typescript-eslint/parser": "^5.7.0",
18 | "eslint-config-airbnb": "^19.0.2",
19 | "eslint-config-airbnb-base": "^15.0.0",
20 | "eslint-config-airbnb-typescript": "^16.1.0",
21 | "eslint-config-next": "^12.2.0",
22 | "eslint-config-prettier": "^8.3.0",
23 | "eslint-import-resolver-typescript": "^2.5.0",
24 | "eslint-plugin-import": "^2.25.3",
25 | "eslint-plugin-jest": "^25.3.0",
26 | "eslint-plugin-jest-dom": "^4.0.1",
27 | "eslint-plugin-node": "^11.1.0",
28 | "eslint-plugin-react": "7.28.0",
29 | "eslint-plugin-testing-library": "^5.0.1"
30 | },
31 | "devDependencies": {
32 | "@tailwindcss/aspect-ratio": "^0.4.0",
33 | "@tailwindcss/forms": "^0.5.2",
34 | "@tailwindcss/line-clamp": "^0.4.0",
35 | "@tailwindcss/typography": "^0.5.2",
36 | "autoprefixer": "^10.4.7",
37 | "postcss": "^8.4.14",
38 | "tailwindcss": "^3.1.3"
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/packages/config/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/packages/config/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const defaultConfig = require('tailwindcss/defaultConfig')
2 | const colors = require('tailwindcss/colors')
3 | const formsPlugin = require('@tailwindcss/forms')
4 | const aspectRatioPlugin = require('@tailwindcss/aspect-ratio')
5 | const typographyPlugin = require('@tailwindcss/typography')
6 | const lineClampPlugin = require('@tailwindcss/line-clamp')
7 |
8 | module.exports = {
9 | content: [
10 | '../../packages/ui/src/**/*.{ts,tsx}',
11 | '../../packages/editor/src/**/*.{ts,tsx}',
12 | '../../packages/icanvas/src/**/*.{ts,tsx}',
13 | './index.html',
14 | './src/**/*.{vue,js,ts,jsx,tsx}',
15 | ],
16 | theme: {
17 | screens: {
18 | xs: '320px',
19 | ...defaultConfig.theme.screens,
20 | },
21 | fontFamily: {
22 | main: ['Gilroy', ...defaultConfig.theme.fontFamily.sans],
23 | body: ['InterBody', ...defaultConfig.theme.fontFamily.sans],
24 | },
25 | fontSize: {
26 | 'size-2xl': ['32px', '40px'],
27 | 'size-xl': ['28px', '32px'],
28 | 'size-lg': ['20px', '28px'],
29 | 'size-md': ['16px', '24px'],
30 | 'size-sm-title': ['14px', '20px'],
31 | 'size-sm': ['14px', '16px'],
32 | 'size-xs-title': ['12px', '20px'],
33 | 'size-xs': ['12px', '16px'],
34 | 'size-xxs': ['11px', '16px'],
35 | },
36 | extend: {
37 | borderRadius: {
38 | sm: '4px',
39 | },
40 | colors: {
41 | gray: {
42 | ...colors.zinc,
43 | },
44 | 'cool-gray': {
45 | ...colors.gray,
46 | },
47 | dark: {
48 | 100: '#383b40',
49 | 200: '#2e2f34',
50 | 300: '#28292d',
51 | 400: '#1f2024',
52 | 500: '#121212',
53 | title: {
54 | DEFAULT: 'rgba(255, 255, 255, 0.9);',
55 | 200: '#929397',
56 | },
57 | body: {
58 | 100: '#C5C5C5',
59 | },
60 | },
61 | },
62 | },
63 | },
64 | experimental: { optimizeUniversalDefaults: true },
65 | plugins: [formsPlugin, aspectRatioPlugin, typographyPlugin, lineClampPlugin],
66 | }
67 |
--------------------------------------------------------------------------------
/packages/config/tsconfig-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Default",
4 | "compilerOptions": {
5 | "composite": false,
6 | "declaration": true,
7 | "declarationMap": true,
8 | "esModuleInterop": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "inlineSources": false,
11 | "isolatedModules": true,
12 | "moduleResolution": "node",
13 | "noUnusedLocals": true,
14 | "noUnusedParameters": true,
15 | "preserveWatchOutput": true,
16 | "skipLibCheck": true,
17 | "strict": true
18 | },
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/packages/config/tsconfig-next.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "Webfront",
4 | "extends": "./tsconfig-base.json",
5 | "compilerOptions": {
6 | "target": "es5",
7 | "lib": ["dom", "dom.iterable", "esnext"],
8 | "allowJs": true,
9 | "skipLibCheck": true,
10 | "strict": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "noEmit": true,
13 | "incremental": true,
14 | "esModuleInterop": true,
15 | "module": "esnext",
16 | "resolveJsonModule": true,
17 | "isolatedModules": true,
18 | "jsx": "preserve",
19 | "downlevelIteration": true
20 | },
21 | "include": ["src", "next-env.d.ts"],
22 | "exclude": ["node_modules"]
23 | }
24 |
--------------------------------------------------------------------------------
/packages/config/tsconfig-react.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/tsconfig",
3 | "display": "UI Library",
4 | "extends": "./tsconfig-base.json",
5 | "compilerOptions": {
6 | "lib": ["ES2015", "DOM"],
7 | "module": "ESNext",
8 | "target": "ES6",
9 | "jsx": "react-jsx"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/packages/editor/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintReact = require('config/eslint-react.js')
2 |
3 | module.exports = {
4 | ...eslintReact,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | },
9 | rules: {
10 | ...eslintReact.rules,
11 | 'import/prefer-default-export': 'off',
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/editor/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Code.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_CodeSandbox.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Heading1.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Heading2.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Heading3.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Image.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_List.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_ScreenGrab.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Stackblitz.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Text.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Command_Video.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/Logo.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/crop-outline.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/packages/editor/src/assets/record-screen.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/packages/editor/src/assets/record-screen.jpeg
--------------------------------------------------------------------------------
/packages/editor/src/assets/trim.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/packages/editor/src/nodes/extension-code/CodeBlock.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { NodeViewContent, NodeViewWrapper } from '@tiptap/react'
16 | import { listLanguages } from 'lowlight/lib/core'
17 | import allowedLanguages from '../../utils/allowedLanguages'
18 |
19 | const CodeBlockComponent = ({
20 | node: {
21 | attrs: { language: defaultLanguage, id },
22 | },
23 | updateAttributes,
24 | }: any) => (
25 |
26 |
44 |
45 |
46 |
47 |
48 | Shift + Enter to exit code
49 |
50 |
51 | )
52 |
53 | export default CodeBlockComponent
54 |
--------------------------------------------------------------------------------
/packages/editor/src/nodes/extension-code/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { Editor } from '@tiptap/core'
16 | import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
17 | import { ReactNodeViewRenderer } from '@tiptap/react'
18 | import lowlight from 'lowlight'
19 | import CodeBlockComponent from './CodeBlock'
20 |
21 | export const checkCurrentNode = (editor: Editor, nodeName: string) =>
22 | editor.state.doc.childBefore(editor.state.selection.from).node?.type.name ===
23 | nodeName
24 |
25 | export default CodeBlockLowlight.extend({
26 | addNodeView() {
27 | return ReactNodeViewRenderer(CodeBlockComponent)
28 | },
29 |
30 | addKeyboardShortcuts() {
31 | return {
32 | Tab: () => {
33 | if (checkCurrentNode(this.editor, this.name)) {
34 | return this.editor.commands.insertContent(' ')
35 | }
36 | return false
37 | },
38 | }
39 | },
40 | }).configure({ lowlight, defaultLanguage: 'typescript' })
41 |
--------------------------------------------------------------------------------
/packages/editor/src/nodes/extension-interaction/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { mergeAttributes, Node } from '@tiptap/core'
16 | import { ReactNodeViewRenderer } from '@tiptap/react'
17 | import { InteractionBlock } from './InteractionBlock'
18 |
19 | export default Node.create({
20 | name: 'interaction',
21 |
22 | group: 'block',
23 |
24 | atom: true,
25 |
26 | isolating: true,
27 |
28 | content: 'block*',
29 |
30 | addAttributes() {
31 | return {
32 | src: {
33 | default: null,
34 | },
35 | type: {
36 | default: null,
37 | },
38 | }
39 | },
40 |
41 | parseHTML() {
42 | return [
43 | {
44 | tag: 'interaction',
45 | },
46 | ]
47 | },
48 |
49 | renderHTML({ HTMLAttributes }) {
50 | return ['interaction', mergeAttributes(HTMLAttributes), 0]
51 | },
52 |
53 | addNodeView() {
54 | return ReactNodeViewRenderer(InteractionBlock, {})
55 | },
56 | })
57 |
--------------------------------------------------------------------------------
/packages/editor/src/nodes/extension-slash-command/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { Extension } from '@tiptap/core'
16 | import Suggestion, { SuggestionOptions } from '@tiptap/suggestion'
17 |
18 | export default Extension.create({
19 | name: 'slashCommands',
20 |
21 | addOptions() {
22 | return {
23 | ...this.parent?.(),
24 | suggestion: {
25 | char: '/',
26 | startOfLine: true,
27 | command: ({ editor, range, props }) => {
28 | props.command({ editor, range, props })
29 | },
30 | } as Partial,
31 | }
32 | },
33 |
34 | addProseMirrorPlugins() {
35 | return [
36 | Suggestion({
37 | ...this.options.suggestion,
38 | editor: this.editor,
39 | }),
40 | ]
41 | },
42 | })
43 |
--------------------------------------------------------------------------------
/packages/editor/src/nodes/extension-video/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { mergeAttributes, Node } from '@tiptap/core'
16 | import { ReactNodeViewRenderer } from '@tiptap/react'
17 | import { VideoBlock } from './VideoBlock'
18 |
19 | export default Node.create({
20 | name: 'video',
21 |
22 | group: 'block',
23 |
24 | content: 'block*',
25 |
26 | atom: true,
27 |
28 | isolating: true,
29 |
30 | parseHTML() {
31 | return [
32 | {
33 | tag: 'video',
34 | },
35 | ]
36 | },
37 |
38 | addAttributes() {
39 | return {
40 | src: {
41 | default: null,
42 | },
43 | associatedBlockId: {
44 | default: null,
45 | },
46 | 'data-transformations': {
47 | default: null,
48 | },
49 | caption: {
50 | default: null,
51 | },
52 | type: {
53 | default: 'video', // video, screengrab
54 | },
55 | }
56 | },
57 |
58 | renderHTML({ HTMLAttributes }) {
59 | return ['video', mergeAttributes(HTMLAttributes), 0]
60 | },
61 |
62 | addNodeView() {
63 | return ReactNodeViewRenderer(VideoBlock)
64 | },
65 | })
66 |
--------------------------------------------------------------------------------
/packages/editor/src/styles/tinyEditorStyle.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { css } from '@emotion/css'
16 |
17 | const tinyEditorStyle = css`
18 | background: none;
19 | background-color: transparent;
20 |
21 | p {
22 | color: white;
23 | font-family: 'Inter';
24 | word-wrap: break-word;
25 | }
26 |
27 | p.is-empty::before {
28 | color: rgba(209, 213, 219);
29 | content: attr(data-placeholder);
30 | float: left;
31 | height: 0;
32 | pointer-events: none;
33 | }
34 | `
35 |
36 | export default tinyEditorStyle
37 |
--------------------------------------------------------------------------------
/packages/editor/src/utils/allowedLanguages.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const allowedLanguages = {
16 | batch: '.bat',
17 | c: '.c',
18 | 'c++': '.cpp',
19 | clojure: '.clj',
20 | css: '.css',
21 | dockerfile: '.dockerfile',
22 | go: '.go',
23 | html: '.html',
24 | jade: '.jade',
25 | java: '.java',
26 | javascript: '.js',
27 | javascriptreact: '.jsx',
28 | json: '.json',
29 | markdown: '.md',
30 | 'objective-c': '.m',
31 | perl: '.pl',
32 | php: '.php',
33 | powershell: '.ps1',
34 | properties: '.properties',
35 | python: '.py',
36 | r: '.r',
37 | ruby: '.rb',
38 | rust: '.rs',
39 | scss: '.scss',
40 | shellscript: '.sh',
41 | sql: '.sql',
42 | swift: '.swift',
43 | typescript: '.ts',
44 | typescriptreact: '.tsx',
45 | xml: '.xml',
46 | yaml: '.yaml',
47 | graphql: '.graphql',
48 | haskell: '.hs',
49 | matlab: '.m',
50 | }
51 |
52 | const allowedExtensions: string[] = Object.values(allowedLanguages)
53 |
54 | export { allowedExtensions }
55 | export default allowedLanguages
56 |
--------------------------------------------------------------------------------
/packages/editor/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('config/tailwind.config')
2 |
--------------------------------------------------------------------------------
/packages/editor/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-react.json",
3 | "compilerOptions": {
4 | "disableSizeLimit": true
5 | },
6 | "include": ["."],
7 | "exclude": ["dist", "build", "node_modules"]
8 | }
9 |
--------------------------------------------------------------------------------
/packages/editor/types.d.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | declare module '*.svg' {
16 | const content: any
17 | export default content
18 | }
19 |
20 | declare module '*.jpeg'
21 |
--------------------------------------------------------------------------------
/packages/icanvas/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintReact = require('config/eslint-react.js')
2 |
3 | module.exports = {
4 | ...eslintReact,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | },
9 | rules: {
10 | ...eslintReact.rules,
11 | 'import/prefer-default-export': 'off',
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/icanvas/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "icanvas",
3 | "version": "0.0.0",
4 | "main": "./index.tsx",
5 | "types": "./index.tsx",
6 | "license": "MIT",
7 | "scripts": {
8 | "lint": "eslint ./**/*.ts* --fix"
9 | },
10 | "devDependencies": {
11 | "@types/react": "^17.0.37",
12 | "@types/react-dom": "^17.0.11",
13 | "config": "*",
14 | "eslint": "^7.32.0",
15 | "typescript": "^4.5.2"
16 | },
17 | "dependencies": {
18 | "konva": "^8.3.10",
19 | "react": "17.0.2",
20 | "react-konva": "^17.0.2-5"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/packages/icanvas/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-react.json",
3 | "include": ["."],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/prisma-orm/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintNext = require('config/eslint-next.js')
2 |
3 | module.exports = {
4 | ...eslintNext,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | },
9 | }
10 |
--------------------------------------------------------------------------------
/packages/prisma-orm/README.md:
--------------------------------------------------------------------------------
1 | # DB Setup
2 |
3 | Planetscale DB does not support 2 imortant things we find in regular DBs:
4 |
5 | - foreign keys ( hence we need to explicitly define indexes on foreign key column to avoid full table scans )
6 | - functions/procedures ( we will need to move sql function logic such as `generate_link` used for slug generation to application logic).
7 |
8 | ## Note while using prisma client
9 |
10 | Always mention select parameters in query, otherwise it will return all columns.
11 |
12 | - It's important to always explicitly say which fields you want to return in order to not leak extra information
13 | - @see https://github.com/prisma/prisma/issues/9353
14 |
--------------------------------------------------------------------------------
/packages/prisma-orm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "prisma-orm",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "lint": "eslint ./**/*.ts* --fix",
7 | "seed": "ts-node seed.ts",
8 | "postinstall": "prisma generate"
9 | },
10 | "dependencies": {
11 | "@prisma/client": "^4.0.0"
12 | },
13 | "devDependencies": {
14 | "typescript": "^4.5.3"
15 | },
16 | "prisma": {
17 | "schema": "schema.prisma"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/packages/prisma-orm/prisma.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /**
16 | * Instantiates a single instance PrismaClient and save it on the global object.
17 | * @link https://www.prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices
18 | */
19 | import { PrismaClient } from '@prisma/client'
20 |
21 | const prismaGlobal = global as typeof global & {
22 | prisma?: PrismaClient
23 | }
24 |
25 | const prisma: PrismaClient =
26 | prismaGlobal.prisma ||
27 | new PrismaClient({
28 | datasources: {
29 | db: { url: process.env.DATABASE_URL },
30 | },
31 | // log:
32 | // process.env.NODE_ENV === 'development' || !process.env.NODE_ENV
33 | // ? ['query', 'error', 'warn']
34 | // : ['error'],
35 | })
36 |
37 | if (process.env.NODE_ENV !== 'production') {
38 | prismaGlobal.prisma = prisma
39 | }
40 |
41 | export default prisma
42 |
--------------------------------------------------------------------------------
/packages/prisma-orm/seed.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { PrismaClient } from '@prisma/client'
16 | import themes from './data/themes'
17 | import transitions from './data/transitions'
18 |
19 | const prisma = new PrismaClient()
20 |
21 | async function main() {
22 | // Seed themes
23 | console.log('Seeding themes ...')
24 | await prisma.$transaction([
25 | prisma.theme.deleteMany({ where: {} }),
26 | prisma.theme.createMany({ data: themes }),
27 | ])
28 | console.log(`Added ${themes.length} themes.`)
29 |
30 | // Seed transitions
31 | console.log('Seeding transitions...')
32 | await prisma.$transaction([
33 | prisma.transition.deleteMany({ where: {} }),
34 | prisma.transition.createMany({ data: transitions }),
35 | ])
36 | console.log(`Added ${transitions.length} transitions.`)
37 | }
38 |
39 | main()
40 | .then(async () => {
41 | await prisma.$disconnect()
42 | })
43 | .catch(async e => {
44 | console.error(e)
45 | await prisma.$disconnect()
46 | process.exit(1)
47 | })
48 |
--------------------------------------------------------------------------------
/packages/prisma-orm/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-next.json",
3 | "include": ["./*.ts", "**/*.ts", "**/*.tsx", "pre-build.js"],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/server/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintNode = require('config/eslint-node.js')
2 |
3 | module.exports = {
4 | ...eslintNode,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | sourceType: 'module',
9 | ecmaVersion: 2020,
10 | },
11 | }
12 |
--------------------------------------------------------------------------------
/packages/server/createRouter.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { router } from '@trpc/server'
16 | import superjson from 'superjson'
17 | import { Context } from './createContext'
18 | import { Meta } from './utils/helpers'
19 |
20 | function createRouter() {
21 | return router().transformer(superjson)
22 | }
23 |
24 | export default createRouter
25 |
--------------------------------------------------------------------------------
/packages/server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "server",
3 | "version": "0.0.0",
4 | "private": true,
5 | "engines": {
6 | "npm": ">=7.0.0",
7 | "node": ">=14.0.0"
8 | },
9 | "scripts": {
10 | "test": "jest --setupFiles dotenv/config",
11 | "lint": "eslint ./**/*.ts* --fix",
12 | "seed": "ts-node packages/prisma-orm/seed.ts",
13 | "prepare": "yarn fetch-env",
14 | "prebuild": "yarn fetch-env",
15 | "fetch-env": "node -r dotenv/config env.fetch.js"
16 | },
17 | "dependencies": {
18 | "@hocuspocus/transformer": "^1.0.0-alpha.23",
19 | "@liveblocks/client": "^0.17.7",
20 | "@mux/mux-node": "^5.1.0",
21 | "@prisma/client": "^4.0.0",
22 | "@tiptap/core": "^2.0.0-beta.182",
23 | "@tiptap/extension-document": "^2.0.0-beta.17",
24 | "@tiptap/extension-paragraph": "^2.0.0-beta.26",
25 | "@tiptap/extension-text": "^2.0.0-beta.17",
26 | "@trpc/react": "^9.26.2",
27 | "@trpc/server": "^9.25.3",
28 | "agora-access-token": "^2.0.4",
29 | "aws-sdk": "^2.1167.0",
30 | "axios": "^0.27.2",
31 | "customerio-node": "^3.3.2",
32 | "firebase": "^9.8.4",
33 | "firebase-admin": "^11.0.0",
34 | "mime": "^3.0.0",
35 | "nanoid": "^4.0.0",
36 | "prisma-orm": "*",
37 | "redis": "^4.2.0",
38 | "superjson": "^1.9.1",
39 | "utils": "*",
40 | "uuid": "^8.3.2",
41 | "ws": "^8.8.1",
42 | "yjs": "^13.5.39",
43 | "yup": "^0.32.11",
44 | "zod": "^3.17.3"
45 | },
46 | "devDependencies": {
47 | "@types/jest": "^28.1.4",
48 | "@types/mime": "3.0.0",
49 | "@types/uuid": "^8.3.4",
50 | "dotenv": "^16.0.1",
51 | "eslint": "7.32.0",
52 | "jest": "^28.1.2",
53 | "jest-mock-extended": "^2.0.6",
54 | "prisma": "^4.0.0",
55 | "ts-jest": "^28.0.5",
56 | "typescript": "^4.5.3"
57 | },
58 | "prisma": {
59 | "schema": "prisma-orm/schema.prisma"
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/packages/server/routes/route.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import serverEnvs from '../utils/env'
16 | import createRouter from '../createRouter'
17 | import userRouter from './user'
18 | import utilsRouter from './utils'
19 | import storyRouter from './story'
20 | import collaborateRouter from './collaborate'
21 | import fragmentRouter from './fragment'
22 | import recordingRouter from './record'
23 | import blockRouter from './block'
24 | import seriesRouter from './series'
25 |
26 | const appRouter = createRouter()
27 | .merge('user.', userRouter)
28 | .merge('series.', seriesRouter)
29 | .merge('story.', storyRouter)
30 | .merge('collab.', collaborateRouter)
31 | .merge('fragment.', fragmentRouter)
32 | .merge('recording.', recordingRouter)
33 | .merge('block.', blockRouter)
34 | .merge('util.', utilsRouter)
35 | .query('healthz', {
36 | async resolve() {
37 | return 'Up!'
38 | },
39 | })
40 | // remove stack and trace from error as it may contain sensitive data
41 | .formatError(({ shape, error }) => ({
42 | ...shape,
43 | data: {
44 | error: {
45 | code: error.code,
46 | message: serverEnvs.NODE_ENV !== 'production' ? error.message : '',
47 | stack: serverEnvs.NODE_ENV !== 'production' ? error.stack : '',
48 | },
49 | },
50 | }))
51 |
52 | export type AppRouter = typeof appRouter
53 |
54 | export default appRouter
55 |
--------------------------------------------------------------------------------
/packages/server/sample.secret.json:
--------------------------------------------------------------------------------
1 | {
2 | "NODE_ENV": "development",
3 | "ALLOWED_EXT": "gif,jpeg,jpg,png,svg,m3u8,mp4,ts,webp,webm,mov,json,yaml,txt,woff,woff2",
4 | "AGORA_APP_ID": "",
5 | "AGORA_APP_CERTIFICATE": "",
6 | "DATABASE_URL": "",
7 | "MUX_TOKEN_ID": "-",
8 | "MUX_TOKEN_SECRET": "-",
9 | "MUX_SIGNING_SECRET": "-",
10 | "COOKIE_DOMAIN": "localhost",
11 | "REDIS_ENDPOINT": "127.0.0.1",
12 | "REDIS_PORT": "6379",
13 | "REDIS_PASSWORD": "redispwd",
14 | "WEBHOOK_SECRET": "randomstring",
15 | "INTEGRATIONS_URL": "nil",
16 | "NEXT_API_BASE_URL": "http://localhost:3000/api",
17 | "TOKENIZE_ENDPOINT": "localhost:8080",
18 | "CUSTOMERIO_APP_ID": "optional",
19 | "CUSTOMERIO_API_KEY": "optional",
20 | "CUSTOMERIO_SITE_ID": "optional",
21 | "CUSTOMERIO_TRANSACTIONAL_APP_API_KEY": "nil",
22 | "LIVEBLOCKS_API_KEY": "",
23 | "LIVEBLOCKS_PUBLIC_KEY": "",
24 | "UNSPLASH_ACCESS_KEY": "",
25 | "NEXT_PUBLIC_BASE_URL": "http://localhost:3000",
26 | "NEXT_STUDIO_BASE_URL": "http://localhost:3000",
27 | "FIREBASE_SERVICE_CONFIG": "",
28 | "SECURITY_DYN_LINK_DOMAIN": "",
29 | "AWS_ACCESS_KEY_ID": "",
30 | "AWS_SECRET_ACCESS_KEY": "",
31 | "AWS_S3_UPLOAD_BUCKET": "",
32 | "AWS_MEDIA_CONVERT_QUEUE": "",
33 | "AWS_MEDIA_CONVERT_REGION": "",
34 | "AWS_MEDIA_CONVERT_ENDPOINT": "",
35 | "AWS_MEDIA_CONVERT_ROLE_ARN": "",
36 | "AWS_MEDIA_CONVERT_MAX_BITRATE": "",
37 | "AWS_MEDIA_CONVERT_INPUT_BUCKET_URL": "",
38 | "AWS_MEDIA_CONVERT_OUTPUT_BUCKET_URL": "",
39 | "DOPPLER_CONFIG": "-",
40 | "DOPPLER_ENVIRONMENT": "-",
41 | "DOPPLER_PROJECT": "-"
42 | }
43 |
--------------------------------------------------------------------------------
/packages/server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-next.json",
3 | "compilerOptions": {
4 | "disableSizeLimit": true,
5 | "declaration": false,
6 | "declarationMap": false,
7 | "skipLibCheck": true
8 | },
9 | "include": ["**/*.ts", "**/*.tsx", "env.fetch.js"],
10 | "exclude": ["dist", "build", "node_modules"]
11 | }
12 |
--------------------------------------------------------------------------------
/packages/server/utils/VideoBlock.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { mergeAttributes, Node } from '@tiptap/core'
16 |
17 | export default Node.create({
18 | name: 'video',
19 |
20 | group: 'block',
21 |
22 | content: 'block*',
23 |
24 | atom: true,
25 |
26 | isolating: true,
27 |
28 | parseHTML() {
29 | return [
30 | {
31 | tag: 'video',
32 | },
33 | ]
34 | },
35 |
36 | addAttributes() {
37 | return {
38 | src: {
39 | default: null,
40 | },
41 | associatedBlockId: {
42 | default: null,
43 | },
44 | 'data-transformations': {
45 | default: null,
46 | },
47 | caption: {
48 | default: null,
49 | },
50 | type: {
51 | default: 'video', // video, screengrab
52 | },
53 | }
54 | },
55 |
56 | renderHTML({ HTMLAttributes }) {
57 | return ['video', mergeAttributes(HTMLAttributes), 0]
58 | },
59 | })
60 |
--------------------------------------------------------------------------------
/packages/server/utils/aws.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { S3 } from 'aws-sdk'
16 | import serverEnvs from './env'
17 |
18 | const s3 = new S3({
19 | accessKeyId: serverEnvs.AWS_ACCESS_KEY_ID,
20 | secretAccessKey: serverEnvs.AWS_SECRET_ACCESS_KEY,
21 | })
22 |
23 | // eslint-disable-next-line import/prefer-default-export
24 | export { s3 }
25 |
--------------------------------------------------------------------------------
/packages/server/utils/generateAgoraToken.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { RtcTokenBuilder, RtcRole } from 'agora-access-token'
16 | import serverEnvs from './env'
17 |
18 | const generateAgoraToken = (
19 | channelName: string,
20 | uid: string,
21 | role?: number
22 | ) => {
23 | const expirationTimeInSeconds = 3600
24 |
25 | const currentTimestamp = Math.floor(Date.now() / 1000)
26 |
27 | const privilegeExpiredTs = currentTimestamp + expirationTimeInSeconds
28 | const token = RtcTokenBuilder.buildTokenWithAccount(
29 | serverEnvs.AGORA_APP_ID,
30 | serverEnvs.AGORA_APP_CERTIFICATE,
31 | channelName,
32 | uid,
33 | role || RtcRole.PUBLISHER,
34 | privilegeExpiredTs
35 | )
36 | return { token, success: true }
37 | }
38 |
39 | export default generateAgoraToken
40 |
--------------------------------------------------------------------------------
/packages/server/utils/jwt.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { initFirebaseAdmin } from './helpers'
16 |
17 | async function verifyJwt(token: string) {
18 | if (!token) {
19 | return null
20 | }
21 | try {
22 | const admin = initFirebaseAdmin()
23 | const decoded = await admin.auth().verifyIdToken(token)
24 | return decoded
25 | } catch (e) {
26 | console.log(e)
27 | return null
28 | }
29 | }
30 |
31 | async function verifyCookie(cookie: string) {
32 | try {
33 | const admin = initFirebaseAdmin()
34 | const decoded = await admin.auth().verifySessionCookie(cookie)
35 | return decoded
36 | } catch (e) {
37 | console.log(e)
38 | return null
39 | }
40 | }
41 |
42 | export { verifyJwt, verifyCookie }
43 |
--------------------------------------------------------------------------------
/packages/server/utils/upload.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import mime from 'mime'
16 | import serverEnvs from './env'
17 |
18 | const allowedExtensions = serverEnvs.ALLOWED_EXT?.split(',') || []
19 |
20 | const isKeyAllowed = async (key: string) => {
21 | const ext = key.split('.').pop()?.trim()
22 | if (!ext) return { ext: null, valid: false }
23 |
24 | return {
25 | ext: ext.toString(),
26 | mime: mime.getType(ext)?.toString(),
27 | valid: allowedExtensions.includes(ext),
28 | }
29 | }
30 |
31 | // eslint-disable-next-line import/prefer-default-export
32 | export { isKeyAllowed }
33 |
--------------------------------------------------------------------------------
/packages/ui/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintReact = require('config/eslint-react.js')
2 |
3 | module.exports = {
4 | ...eslintReact,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | },
9 | rules: {
10 | ...eslintReact.rules,
11 | 'import/prefer-default-export': 'off',
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/ui/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ui",
3 | "version": "0.0.0",
4 | "main": "./index.tsx",
5 | "types": "./index.tsx",
6 | "license": "MIT",
7 | "scripts": {
8 | "lint": "eslint ./**/*.ts* --fix"
9 | },
10 | "devDependencies": {
11 | "@types/react": "^17.0.37",
12 | "@types/react-dom": "^17.0.11",
13 | "autoprefixer": "^10.4.7",
14 | "config": "*",
15 | "eslint": "^7.32.0",
16 | "postcss": "^8.4.14",
17 | "tailwindcss": "^3.1.3",
18 | "typescript": "^4.5.2"
19 | },
20 | "dependencies": {
21 | "@emotion/css": "^11.9.0",
22 | "@emotion/react": "^11.9.3",
23 | "@emotion/styled": "^11.9.3",
24 | "@headlessui/react": "^1.6.5",
25 | "@vime/core": "^5.3.1",
26 | "@vime/react": "^5.3.1",
27 | "axios": "^0.27.2",
28 | "change-case": "^4.1.2",
29 | "nanoid": "^4.0.0",
30 | "react": "17.0.2",
31 | "react-canvas-confetti": "^1.3.0",
32 | "react-icons": "^4.4.0",
33 | "react-toastify": "^9.0.5"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/packages/ui/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/packages/ui/src/Avatar.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable jsx-a11y/click-events-have-key-events */
16 | /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
17 | import { cx } from '@emotion/css'
18 | import axios from 'axios'
19 | import { HTMLProps } from 'react'
20 |
21 | export const isImageLoaded = async (src: string) => {
22 | try {
23 | const { status } = await axios.get(src)
24 | if (status === 200) return true
25 | return false
26 | } catch (e) {
27 | return false
28 | }
29 | }
30 |
31 | export const Avatar = ({
32 | className,
33 | alt,
34 | src,
35 | name,
36 | onClick,
37 | }: { name: string } & HTMLProps) => {
38 | if (src && src?.includes('cdn')) {
39 | return (
40 |
41 | )
42 | }
43 |
44 | return (
45 |
51 | )
52 | }
53 |
--------------------------------------------------------------------------------
/packages/ui/src/Container.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/jsx-props-no-spreading */
16 | import { cx } from '@emotion/css'
17 | import { HTMLAttributes } from 'react'
18 |
19 | export const Container = ({
20 | className,
21 | ...rest
22 | }: HTMLAttributes) => (
23 |
24 | )
25 |
--------------------------------------------------------------------------------
/packages/ui/src/Heading.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { cx } from '@emotion/css'
16 | import { createElement, HTMLProps } from 'react'
17 |
18 | interface HeadingProps extends HTMLProps {
19 | as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
20 | textStyle?:
21 | | 'heading'
22 | | 'title'
23 | | 'mediumTitle'
24 | | 'smallTitle'
25 | | 'extraSmallTitle'
26 | }
27 |
28 | export const Heading = ({
29 | as,
30 | textStyle,
31 | children,
32 | className,
33 | ...rest
34 | }: HeadingProps) =>
35 | createElement(
36 | as || 'h2',
37 | {
38 | className: cx(
39 | 'font-main',
40 | {
41 | 'text-size-2xl': textStyle === 'heading',
42 | 'text-size-xl': textStyle === 'title',
43 | 'text-size-lg': textStyle === 'mediumTitle',
44 | 'text-size-sm-title': textStyle === 'smallTitle',
45 | 'text-size-xs-title': textStyle === 'extraSmallTitle',
46 | },
47 | className
48 | ),
49 | ...rest,
50 | },
51 | children
52 | )
53 |
54 | Heading.defaultProps = {
55 | as: 'h2',
56 | textStyle: 'title',
57 | }
58 |
--------------------------------------------------------------------------------
/packages/ui/src/Label.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/jsx-props-no-spreading */
16 | import { cx } from '@emotion/css'
17 | import { HTMLAttributes } from 'react'
18 |
19 | const Label = ({
20 | className,
21 | ...rest
22 | }: HTMLAttributes) => (
23 |
24 | )
25 |
26 | export default Label
27 |
--------------------------------------------------------------------------------
/packages/ui/src/Loader.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/jsx-props-no-spreading */
16 | import { cx } from '@emotion/css'
17 | import { HTMLAttributes } from 'react'
18 |
19 | export const Loader = ({
20 | className,
21 | ...rest
22 | }: HTMLAttributes) => (
23 |
24 | )
25 |
--------------------------------------------------------------------------------
/packages/ui/src/ScreenState.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { Loader } from './Loader'
16 |
17 | export const ScreenState = ({
18 | title,
19 | subtitle,
20 | button,
21 | onHandleClick,
22 | loading = true,
23 | }: {
24 | title?: string
25 | subtitle?: string
26 | button?: string
27 | onHandleClick?: () => void
28 | loading?: boolean
29 | }) => (
30 |
31 | {loading && }
32 |
33 |
34 | {title && (
35 |
36 | {title}
37 |
38 | )}
39 | {subtitle && (
40 |
{subtitle}
41 | )}
42 |
43 | {button && (
44 |
47 | )}
48 |
49 | )
50 |
51 | ScreenState.defaultProps = {
52 | title: undefined,
53 | subtitle: undefined,
54 | button: undefined,
55 | onHandleClick: undefined,
56 | loading: true,
57 | }
58 |
--------------------------------------------------------------------------------
/packages/ui/src/Switch.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/require-default-props */
16 | import { cx } from '@emotion/css'
17 | import { Switch as HeadlessSwitch } from '@headlessui/react'
18 |
19 | export const Switch = ({
20 | label,
21 | checked,
22 | disabled,
23 | labelClassName,
24 | onChange,
25 | }: {
26 | label?: string
27 | checked: boolean
28 | disabled?: boolean
29 | labelClassName?: string
30 | onChange: (checked: boolean) => void
31 | }) => (
32 |
33 |
34 |
35 | {label}
36 |
37 |
45 |
50 |
51 |
52 |
53 | )
54 |
--------------------------------------------------------------------------------
/packages/ui/src/Text.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | /* eslint-disable react/jsx-props-no-spreading */
16 | import { cx } from '@emotion/css'
17 | import { HTMLProps } from 'react'
18 |
19 | interface TextProps extends HTMLProps {
20 | textStyle?:
21 | | 'bodyStandard'
22 | | 'body'
23 | | 'bodySmall'
24 | | 'caption'
25 | | 'standardLink'
26 | | 'smallLink'
27 | }
28 |
29 | export const Text = ({
30 | textStyle,
31 | className,
32 | children,
33 | ...rest
34 | }: TextProps) => (
35 |
49 | {children}
50 |
51 | )
52 |
53 | Text.defaultProps = {
54 | textStyle: 'bodyStandard',
55 | }
56 |
--------------------------------------------------------------------------------
/packages/ui/src/Toast.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import { toast, ToastContainer as TC } from 'react-toastify'
16 | import { ToastOptions } from 'react-toastify/dist/types'
17 |
18 | export const defaultToastOptions: ToastOptions = {
19 | position: toast.POSITION.BOTTOM_CENTER,
20 | autoClose: 2000,
21 | hideProgressBar: true,
22 | closeOnClick: true,
23 | rtl: false,
24 | pauseOnFocusLoss: true,
25 | draggable: true,
26 | pauseOnHover: true,
27 | theme: 'dark',
28 | closeButton: false,
29 | style: { width: 'fit-content', minHeight: 'auto', maxWidth: '700px' },
30 | bodyStyle: { width: 'auto' },
31 | className: 'flex text-center',
32 | bodyClassName: 'text-size-sm',
33 | } as ToastOptions
34 |
35 | export const emitToast = (
36 | content: string | JSX.Element,
37 | options?: ToastOptions
38 | ) =>
39 | toast(content, {
40 | ...defaultToastOptions,
41 | ...options,
42 | } as ToastOptions)
43 |
44 | export const updateToast = (
45 | id: React.ReactText,
46 | content: string | JSX.Element,
47 | options?: ToastOptions
48 | ) =>
49 | toast.update(id, {
50 | render: content,
51 | ...options,
52 | })
53 |
54 | export const dismissToast = (id: any) => {
55 | toast.dismiss(id)
56 | }
57 |
58 | export const ToastContainer = TC
59 |
--------------------------------------------------------------------------------
/packages/ui/src/assets/CodeSandbox.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/ui/src/assets/StackBlitz.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/ui/src/assets/card_fallback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IncredibleDevHQ/dev-video-creator/a3a31e5c17d6d302f240c61e8a5cf9c23edb0ef0/packages/ui/src/assets/card_fallback.png
--------------------------------------------------------------------------------
/packages/ui/src/index.tsx:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import 'react-toastify/dist/ReactToastify.css'
16 | import './index.css'
17 |
18 | export * from './Avatar'
19 | export * from './Button'
20 | export * from './Heading'
21 | export * from './IconButton'
22 | export * from './Toast'
23 | export * from './Text'
24 | export * from './ScreenState'
25 | export * from './Loader'
26 | export * from './Switch'
27 | export * from './Confetti'
28 | export * from './ThumbnailPreview'
29 | export * from './TextField'
30 | export * from './Container'
31 | export * from './Player'
32 |
--------------------------------------------------------------------------------
/packages/ui/tailwind.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('config/tailwind.config')
2 |
--------------------------------------------------------------------------------
/packages/ui/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-react.json",
3 | "include": ["."],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/ui/types.d.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | declare module '*.svg' {
16 | const content: any
17 | export default content
18 | }
19 |
20 | declare module '*.jpeg'
21 | declare module '*.png'
22 |
--------------------------------------------------------------------------------
/packages/utils/.eslintrc.js:
--------------------------------------------------------------------------------
1 | const eslintReact = require('config/eslint-react.js')
2 |
3 | module.exports = {
4 | ...eslintReact,
5 | parserOptions: {
6 | tsconfigRootDir: __dirname,
7 | project: './tsconfig.json',
8 | },
9 | rules: {
10 | ...eslintReact.rules,
11 | 'import/prefer-default-export': 'off',
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/utils/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "utils",
3 | "version": "0.0.1",
4 | "main": "./index.tsx",
5 | "types": "./index.tsx",
6 | "license": "MIT",
7 | "scripts": {
8 | "lint": "eslint ./**/*.ts* --fix"
9 | },
10 | "devDependencies": {
11 | "@types/mime": "^2.0.3",
12 | "@types/mime-types": "^2.1.1",
13 | "@types/react": "^17.0.37",
14 | "@types/react-dom": "^17.0.11",
15 | "config": "*",
16 | "eslint": "^7.32.0",
17 | "typescript": "^4.5.3"
18 | },
19 | "dependencies": {
20 | "@liveblocks/client": "^0.17.5",
21 | "axios": "^0.27.2",
22 | "mime": "^3.0.0",
23 | "mime-types": "^2.1.35",
24 | "nanoid": "^4.0.0",
25 | "react": "^17.0.2",
26 | "ts-ebml": "^2.0.2"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/packages/utils/src/helpers/get-seekable-webm.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import * as ebml from 'ts-ebml'
16 | // import { Buffer } from 'buffer'
17 |
18 | // /** @ts-ignore */
19 | // window.buffer = Buffer
20 |
21 | function getSeekableWebM(arrayBuffer: ArrayBuffer) {
22 | if (typeof ebml === 'undefined') {
23 | throw new Error('Please link: https://www.webrtc- experiment.com/EBML.js')
24 | }
25 |
26 | const [decoder, , reader, tools] = [
27 | new ebml.Decoder(),
28 | new ebml.Encoder(),
29 | new ebml.Reader(),
30 | ebml.tools,
31 | ]
32 | let elms = decoder.decode(arrayBuffer)
33 | const validEmlType = ['m', 'u', 'i', 'f', 's', '8', 'b', 'd'] // This is from elm type of the lib
34 | elms = elms?.filter(elm => validEmlType.includes(elm.type))
35 | elms.forEach(elm => {
36 | reader.read(elm)
37 | })
38 |
39 | const refinedMetadataBuf = tools.makeMetadataSeekable(
40 | reader.metadatas,
41 | reader.duration,
42 | reader.cues
43 | )
44 | const body = arrayBuffer.slice(reader.metadataSize)
45 | const refinedWebM = new Blob([refinedMetadataBuf, body], {
46 | type: 'video/webm',
47 | })
48 |
49 | return refinedWebM
50 | }
51 |
52 | export default getSeekableWebM
53 |
--------------------------------------------------------------------------------
/packages/utils/src/helpers/suggestion.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import * as crypto from 'crypto'
16 |
17 | export function generateSuggestionsFromEmail(email: string): string {
18 | const nameParts = email.replace(/@.+/, '')
19 | const name = nameParts.replace(/[&/\\#,+()$~%._@'":*?<>{}]/g, '')
20 | const suggestion = name + crypto.randomInt(100, 900).toString()
21 |
22 | return suggestion
23 | }
24 |
--------------------------------------------------------------------------------
/packages/utils/src/helpers/validations.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const validateEmail = (email: string) => {
16 | const re =
17 | /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
18 | return re.test(String(email).toLowerCase())
19 | }
20 |
21 | export { validateEmail }
22 |
--------------------------------------------------------------------------------
/packages/utils/src/hooks/use-env.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const getEnv = () => ({
16 | env: process.env.NEXT_PUBLIC_DEPLOY_ENV,
17 | agora: {
18 | appId: process.env.NEXT_PUBLIC_AGORA_APP_ID,
19 | },
20 | storage: {
21 | cdn: process.env.NEXT_PUBLIC_CDN_URL,
22 | },
23 | client: {
24 | publicUrl: process.env.NEXT_PUBLIC_PUBLIC_URL,
25 | embedPlayerUrl: process.env.NEXT_PUBLIC_EMBED_PLAYER_BASE_URL,
26 | tokenizerUrl: process.env.NEXT_PUBLIC_TOKENIZE_ENDPOINT,
27 | },
28 | hocuspocus: process.env.NEXT_PUBLIC_HOCUSPOCUS_SERVER,
29 | liveblocks: {
30 | publicKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY,
31 | },
32 | googleFontsApiKey: process.env.NEXT_PUBLIC_GOOGLE_FONTS_API_KEY,
33 | giphyApiKey: process.env.NEXT_PUBLIC_GIPHY_API_KEY,
34 | firebaseConfig: JSON.parse(
35 | (process.env.NEXT_PUBLIC_FIREBASE_CONFIG as string) || '{}'
36 | ),
37 | })
38 |
39 | const useEnv = () => getEnv()
40 |
41 | export { useEnv, getEnv }
42 |
--------------------------------------------------------------------------------
/packages/utils/src/hooks/use-get-hw.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | const useGetHW = ({
16 | maxH,
17 | maxW,
18 | aspectRatio,
19 | }: {
20 | maxH: number
21 | maxW: number
22 | aspectRatio: number
23 | }) => {
24 | let calWidth = 0
25 | let calHeight = 0
26 | if (aspectRatio > maxW / maxH) {
27 | calHeight = maxW * (1 / aspectRatio)
28 | calWidth = maxW
29 | } else if (aspectRatio <= maxW / maxH) {
30 | calHeight = maxH
31 | calWidth = maxH * aspectRatio
32 | }
33 | return { width: calWidth, height: calHeight }
34 | }
35 |
36 | export default useGetHW
37 |
--------------------------------------------------------------------------------
/packages/utils/src/hooks/useOutsideClick.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | import React, { useEffect } from 'react'
16 |
17 | const useOutsideClick = (ref: React.RefObject, handler: () => void) => {
18 | useEffect(() => {
19 | function handleClickOutside(event: MouseEvent) {
20 | if (ref.current && !ref.current.contains(event.target)) {
21 | handler()
22 | }
23 | }
24 |
25 | document.addEventListener('mousedown', handleClickOutside)
26 | return () => {
27 | document.removeEventListener('mousedown', handleClickOutside)
28 | }
29 | }, [ref])
30 | }
31 |
32 | export default useOutsideClick
33 |
--------------------------------------------------------------------------------
/packages/utils/src/index.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2022 Pixelbyte Studio Pvt Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | export { default as getSeekableWebM } from './helpers/get-seekable-webm'
16 | export { getEnv, useEnv } from './hooks/use-env'
17 | export { default as useGetHW } from './hooks/use-get-hw'
18 | export { default as useTimekeeper } from './hooks/use-timekeeper'
19 | export { useUploadFile } from './hooks/use-upload-file'
20 | export type { AllowedFileExtensions } from './hooks/use-upload-file'
21 | export { default as useOutsideClick } from './hooks/useOutsideClick'
22 | export * from './types/viewConfig'
23 | export * from './helpers/validations'
24 |
--------------------------------------------------------------------------------
/packages/utils/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "config/tsconfig-react.json",
3 | "include": ["."],
4 | "exclude": ["dist", "build", "node_modules"]
5 | }
6 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "globalDependencies": [".env, **/*/.env"],
3 | "pipeline": {
4 | "prepare": {},
5 | "postinstall": {},
6 | "prebuild": {
7 | "cache": false
8 | },
9 | "build": {
10 | "dependsOn": ["prebuild", "^build"],
11 | "outputs": ["dist/**", ".next/**"]
12 | },
13 | "lint": {
14 | "outputs": []
15 | },
16 | "dev": {
17 | "cache": false
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------