├── public ├── favicon.ico ├── robots.txt ├── img │ ├── pen.png │ ├── edit.png │ ├── logo.png │ ├── save.png │ ├── text.png │ ├── avatar.webp │ ├── caption.jpg │ ├── cursor.png │ └── google.svg ├── worker │ └── arrayWorker.js ├── index.php └── .htaccess ├── database ├── .gitignore ├── seeders │ └── DatabaseSeeder.php ├── migrations │ ├── 2024_11_05_024923_create_joinees_table.php │ ├── 2024_11_01_194659_create_drawings_table.php │ ├── 2024_11_01_194707_create_sticky_notes_table.php │ ├── 2024_11_01_194640_create_text_captions_table.php │ ├── 2024_09_13_183423_create_oauth_personal_access_clients_table.php │ ├── 2024_11_01_194650_create_mini_text_editors_table.php │ ├── 2024_09_13_183421_create_oauth_refresh_tokens_table.php │ ├── 2024_10_26_083709_create_projects_table.php │ ├── 2024_09_13_183419_create_oauth_auth_codes_table.php │ ├── 0001_01_01_000001_create_cache_table.php │ ├── 2024_05_23_122432_create_personal_access_tokens_table.php │ ├── 2024_09_13_183420_create_oauth_access_tokens_table.php │ ├── 2024_09_13_183422_create_oauth_clients_table.php │ ├── 0001_01_01_000000_create_users_table.php │ └── 0001_01_01_000002_create_jobs_table.php └── factories │ └── UserFactory.php ├── bootstrap ├── cache │ └── .gitignore ├── providers.php └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── .rnd ├── resources ├── js │ ├── src │ │ ├── App.vue │ │ ├── types │ │ │ └── global.d.ts │ │ ├── App │ │ │ └── APP.ts │ │ ├── store │ │ │ ├── stickyNote.ts │ │ │ ├── textCaption.ts │ │ │ ├── miniTextEditor.ts │ │ │ ├── projectStore.ts │ │ │ └── yDoc.ts │ │ ├── components │ │ │ ├── icons │ │ │ │ ├── RedoIcon.vue │ │ │ │ ├── ArrowDownIcon.vue │ │ │ │ ├── PlusIcon.vue │ │ │ │ ├── UndoIcon.vue │ │ │ │ ├── CloseIcon.vue │ │ │ │ ├── ItalicIcon.vue │ │ │ │ ├── BoldIcon.vue │ │ │ │ ├── ArrowTopIcon.vue │ │ │ │ ├── LogoutIcon.vue │ │ │ │ ├── UnderLineIcon.vue │ │ │ │ ├── ListIcon.vue │ │ │ │ ├── CenterIcon.vue │ │ │ │ ├── AlignLeftIcon.vue │ │ │ │ ├── AlignRightIcon.vue │ │ │ │ ├── PersonPlusIcon.vue │ │ │ │ ├── QueueListIcon.vue │ │ │ │ ├── H1Icon.vue │ │ │ │ ├── ImageIcon.vue │ │ │ │ ├── StickyNoteIcon.vue │ │ │ │ ├── DocumentIcon.vue │ │ │ │ ├── LinkIcon.vue │ │ │ │ ├── ResetCanvasIcon.vue │ │ │ │ ├── TrashIcon.vue │ │ │ │ ├── H2Icon.vue │ │ │ │ └── H3Icon.vue │ │ │ └── base-components │ │ │ │ ├── Error.vue │ │ │ │ ├── BaseInput.vue │ │ │ │ ├── LoadingIndicator.vue │ │ │ │ └── BaseModal.vue │ │ ├── pages │ │ │ ├── admin │ │ │ │ ├── actions │ │ │ │ │ ├── project-board │ │ │ │ │ │ ├── stickynote │ │ │ │ │ │ │ └── stickyNoteTypes.ts │ │ │ │ │ │ ├── editor │ │ │ │ │ │ │ └── miniTextEditorTypes.ts │ │ │ │ │ │ ├── text-caption │ │ │ │ │ │ │ └── textCaptionTypes.ts │ │ │ │ │ │ ├── cursor │ │ │ │ │ │ │ └── userMouse.ts │ │ │ │ │ │ └── http │ │ │ │ │ │ │ ├── saveBoardData.ts │ │ │ │ │ │ │ ├── getProjectDetail.ts │ │ │ │ │ │ │ └── getProjectBoardData.ts │ │ │ │ │ ├── http │ │ │ │ │ │ ├── trylogout.ts │ │ │ │ │ │ └── logout.ts │ │ │ │ │ ├── project │ │ │ │ │ │ └── http │ │ │ │ │ │ │ ├── getProject.ts │ │ │ │ │ │ │ └── createOrUpdateProject.ts │ │ │ │ │ └── addjoinee │ │ │ │ │ │ └── http │ │ │ │ │ │ └── addJoinee.ts │ │ │ │ ├── addJoinee.vue │ │ │ │ ├── components │ │ │ │ │ ├── project-board │ │ │ │ │ │ ├── BlinkingCursor.vue │ │ │ │ │ │ ├── UndoRedo.vue │ │ │ │ │ │ ├── JoinningUsersModal.vue │ │ │ │ │ │ ├── ColorPalette.vue │ │ │ │ │ │ ├── AddItem.vue │ │ │ │ │ │ ├── StickyNote.vue │ │ │ │ │ │ ├── TextCaption.vue │ │ │ │ │ │ ├── UserCursor.vue │ │ │ │ │ │ └── TopNavBar.vue │ │ │ │ │ └── project │ │ │ │ │ │ ├── UserMenu.vue │ │ │ │ │ │ ├── ProjectList.vue │ │ │ │ │ │ └── ProjectModal.vue │ │ │ │ ├── LearnYjs.vue │ │ │ │ └── ProjectPage.vue │ │ │ └── auth │ │ │ │ ├── actions │ │ │ │ ├── tokenTypes.ts │ │ │ │ └── getToken.ts │ │ │ │ ├── TokenPage.vue │ │ │ │ ├── CallbackPage.vue │ │ │ │ └── LoginPage.vue │ │ ├── helper │ │ │ ├── util.ts │ │ │ ├── toastnotification.ts │ │ │ ├── auth.ts │ │ │ └── makeHttpReq.ts │ │ ├── router │ │ │ └── index.ts │ │ └── yjs │ │ │ ├── yjs.ts │ │ │ └── yjsUtil.ts │ ├── bootstrap.js │ ├── echo.js │ └── app.ts ├── css │ └── input.css └── views │ ├── welcome.blade.php │ └── about.blade.php ├── app ├── Http │ └── Controllers │ │ ├── Controller.php │ │ ├── Auth │ │ └── AuthController.php │ │ └── Project │ │ └── ProjectController.php ├── Models │ ├── Drawing.php │ ├── Joinee.php │ ├── Project.php │ ├── StickyNote.php │ ├── MiniTextEditor.php │ ├── TextCaption.php │ └── User.php ├── Providers │ └── AppServiceProvider.php ├── Listeners │ └── SendEmailVerification.php ├── Events │ ├── UserTypingEvent.php │ └── ProjectBoardEvent.php └── Mail │ └── SendMail.php ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php └── Feature │ └── ExampleTest.php ├── tailwind.config.js ├── .gitattributes ├── routes ├── console.php ├── channels.php ├── web.php └── api.php ├── .editorconfig ├── .gitignore ├── artisan ├── README.md ├── tsconfig.json ├── config ├── cors.php ├── services.php ├── filesystems.php ├── passport.php ├── broadcasting.php ├── sanctum.php ├── reverb.php ├── cache.php ├── mail.php ├── queue.php ├── auth.php ├── app.php ├── logging.php └── database.php ├── vite.config.js ├── package.json ├── phpunit.xml ├── .env.example ├── Todo.md └── composer.json /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /.rnd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/.rnd -------------------------------------------------------------------------------- /resources/js/src/App.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /resources/js/src/types/global.d.ts: -------------------------------------------------------------------------------- 1 | 2 | interface Window{ 3 | Echo:any 4 | } -------------------------------------------------------------------------------- /resources/css/input.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /public/img/pen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/public/img/pen.png -------------------------------------------------------------------------------- /public/img/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/public/img/edit.png -------------------------------------------------------------------------------- /public/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/public/img/logo.png -------------------------------------------------------------------------------- /public/img/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/public/img/save.png -------------------------------------------------------------------------------- /public/img/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bienfait-ijambo/miro-clone/HEAD/public/img/text.png -------------------------------------------------------------------------------- /bootstrap/providers.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 8 | })->purpose('Display an inspiring quote')->hourly(); 9 | -------------------------------------------------------------------------------- /app/Models/Drawing.php: -------------------------------------------------------------------------------- 1 | ({ 5 | stickyNote:{} as {id:number} 6 | }), 7 | 8 | 9 | }); 10 | 11 | export const stickyNoteStore=useStikyNoteStore() -------------------------------------------------------------------------------- /app/Models/Project.php: -------------------------------------------------------------------------------- 1 | ({ 5 | textCaption:{} as {id:number} 6 | }), 7 | 8 | 9 | }); 10 | 11 | export const textCaptionStore=useTextCaptionStore() -------------------------------------------------------------------------------- /resources/js/src/store/miniTextEditor.ts: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia'; 2 | 3 | const useMiniTextEditorStore= defineStore('miniTextEditor', { 4 | state: () => ({ 5 | miniTextEditor:{} as {id:number} 6 | }), 7 | 8 | 9 | }); 10 | 11 | export const miniTextEditorStore=useMiniTextEditorStore() -------------------------------------------------------------------------------- /resources/js/src/components/icons/RedoIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ArrowDownIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/PlusIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/UndoIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/Unit/ExampleTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/stickynote/stickyNoteTypes.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface IStickyNote{ 4 | 5 | id:number 6 | body:string 7 | color:string 8 | dragPosition:{ 9 | x:number 10 | y:number 11 | } 12 | resizePosition:{ 13 | x:number 14 | y:number 15 | } 16 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/editor/miniTextEditorTypes.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface IMiniTextEditor{ 4 | 5 | id:number 6 | body:string 7 | color:string 8 | dragPosition:{ 9 | x:number 10 | y:number 11 | } 12 | resizePosition:{ 13 | x:number 14 | y:number 15 | } 16 | } -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/text-caption/textCaptionTypes.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export interface ITextCaption{ 4 | 5 | id:number 6 | body:string 7 | color:string 8 | dragPosition:{ 9 | x:number 10 | y:number 11 | } 12 | resizePosition:{ 13 | x:number 14 | y:number 15 | } 16 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | /vendor 8 | .env 9 | .env.backup 10 | .env.production 11 | .phpactor.json 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | auth.json 16 | npm-debug.log 17 | yarn-error.log 18 | /.fleet 19 | /.idea 20 | /.vscode 21 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/CloseIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ItalicIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/BoldIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | handleCommand(new ArgvInput); 14 | 15 | exit($status); 16 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ArrowTopIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/LogoutIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/UnderLineIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | window.axios = axios; 3 | 4 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 5 | 6 | /** 7 | * Echo exposes an expressive API for subscribing to channels and listening 8 | * for events that are broadcast by Laravel. Echo and event broadcasting 9 | * allow your team to quickly build robust real-time web applications. 10 | */ 11 | 12 | import './echo'; 13 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ListIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/store/projectStore.ts: -------------------------------------------------------------------------------- 1 | import { ref, computed } from 'vue' 2 | import { defineStore } from 'pinia' 3 | import { ICreateOrUpdateProject } from '../pages/admin/actions/project/http/createOrUpdateProject' 4 | 5 | export const useProjectStore = defineStore('projectStore', () => { 6 | const input = ref({ id: null, name: '', userId: null }) 7 | 8 | 9 | const edit = ref(false) 10 | 11 | return { input,edit} 12 | }) 13 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/CenterIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/http/trylogout.ts: -------------------------------------------------------------------------------- 1 | import { makeHttpReq2 } from "../../../../helper/makeHttpReq" 2 | import { showError } from "../../../../helper/toastnotification" 3 | 4 | export async function tryLogoutUser() { 5 | try { 6 | await makeHttpReq2<{ userId: undefined }, { message: string }>('logout', 'POST', { 7 | userId: undefined 8 | }) 9 | } catch (error) { 10 | showError((error as Error).message) 11 | } 12 | } -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/AlignLeftIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/AlignRightIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /public/worker/arrayWorker.js: -------------------------------------------------------------------------------- 1 | 2 | self.onmessage = function(event) { 3 | const array = event.data; // Get the array from the main thread 4 | const result = processArray(array); // Call the function to process the array 5 | self.postMessage(result); // Send the result back to the main thread 6 | }; 7 | 8 | function processArray(array) { 9 | // Example processing: Sum all elements in the array 10 | return array.reduce((sum, value) => sum + value, 0); 11 | } 12 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/PersonPlusIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/QueueListIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/H1Icon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/js/src/helper/util.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | export function __debounce(cb:(fn:(...args:any[])=>T)=>T,delay:number){ 5 | 6 | let debounceTimer:any 7 | return function(fn:(...args:any[])=>T){ 8 | clearTimeout(debounceTimer); 9 | debounceTimer=setTimeout(()=>cb(fn),delay) 10 | 11 | } 12 | 13 | } 14 | 15 | export async function runFuncSequentially( functions: (() => any | Promise)[] ) { 16 | for (const func of functions) { 17 | await func(); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ImageIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/StickyNoteIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/pages/auth/actions/tokenTypes.ts: -------------------------------------------------------------------------------- 1 | 2 | export type OauthTokenInputType = { 3 | grant_type: 'authorization_code' 4 | client_id: string 5 | redirect_uri: string 6 | code_verifier: string 7 | code: string 8 | 9 | } 10 | export type OauthTokenResponseType = { 11 | token_type: string 12 | expires_in: number 13 | refresh_token: string 14 | access_token: string 15 | } 16 | 17 | export type userResponseType = { 18 | id: string 19 | name: string 20 | email: string 21 | } -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | handleRequest(Request::capture()); 18 | -------------------------------------------------------------------------------- /resources/js/echo.js: -------------------------------------------------------------------------------- 1 | import Echo from 'laravel-echo'; 2 | 3 | import Pusher from 'pusher-js'; 4 | window.Pusher = Pusher; 5 | 6 | window.Echo = new Echo({ 7 | broadcaster: 'reverb', 8 | key: import.meta.env.VITE_REVERB_APP_KEY, 9 | wsHost: import.meta.env.VITE_REVERB_HOST, 10 | wsPort: import.meta.env.VITE_REVERB_PORT ?? 80, 11 | wssPort: import.meta.env.VITE_REVERB_PORT ?? 443, 12 | forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https', 13 | enabledTransports: ['ws', 'wss'], 14 | }) 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/DocumentIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 8 | }); 9 | 10 | 11 | 12 | //Checks if the authenticated user's ID matches the ID in the private channel 13 | Broadcast::channel('typing.{id}', function (User $user, $id) { 14 | return (int) $user->id === (int) $id; 15 | }); 16 | 17 | 18 | Broadcast::channel('project.room.{projectCode}', function ($user, $projectCode){ 19 | return $user; 20 | }); -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 17 | 18 | User::factory()->create([ 19 | 'name' => 'Test User', 20 | 'email' => 'test@example.com', 21 | ]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## RealTime Collaboration App 4 | 5 | ### Steps to run this project: 6 | 7 | 8 | 1. git clone `https://github.com/Bienfait-ijambo/miro-clone.git` 9 | 10 | 2. cd in `in the project` 11 | 12 | 3. Run `composer install` command 13 | 14 | 4. Setup database 15 | 16 | 5. Run `php artisan migrate` 17 | 18 | 6. Run `php artisan serve` command 19 | 20 | 7. Run `php artisan queue:work` for background process 21 | 22 | 8. Run `npm run serve` 23 | 24 | 9. Run `php artisan reverb:start` 25 | 26 | 10. Run yjs server `node ./node_modules/y-websocket/bin/server.cjs` 27 | 28 | 29 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/LinkIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/js/src/pages/auth/TokenPage.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 23 | 24 | 25 | processing... please wait... 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/ResetCanvasIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/js/src/components/base-components/Error.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | {{ props.label }} 11 | 12 | 13 | 14 | 15 | {{ error.$message }} 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/http/logout.ts: -------------------------------------------------------------------------------- 1 | import { makeHttpReq2 } from "../../../../helper/makeHttpReq" 2 | import { showError, successMsg } from "../../../../helper/toastnotification" 3 | 4 | export async function logout(userId:string| undefined) { 5 | try { 6 | 7 | 8 | const data = await makeHttpReq2<{ userId: number }, { message: string }> 9 | ('logout', 'POST', { 10 | userId: parseInt((userId as string)) 11 | }) 12 | window.location.href = '/app/login' 13 | localStorage.clear() 14 | successMsg(data.message) 15 | } catch (error) { 16 | showError((error as Error).message) 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/TrashIcon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /resources/js/src/helper/toastnotification.ts: -------------------------------------------------------------------------------- 1 | 2 | import { useToast } from 'vue-toast-notification' 3 | 4 | const toast = useToast() 5 | 6 | export function showError(message: string) { 7 | if (message === 'Not authenticated' || message === 'Failed to fetch' ) { 8 | // ' 9 | 10 | window.location.href = '/app/login' 11 | localStorage.clear() 12 | } 13 | toast.error(message, { 14 | position: 'bottom-right', 15 | duration: 4000, 16 | dismissible: true 17 | }) 18 | } 19 | 20 | export function successMsg(message: string) { 21 | toast.success(message, { 22 | position: 'bottom-right', 23 | duration: 4000, 24 | dismissible: true 25 | }) 26 | } 27 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/addJoinee.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /resources/js/src/components/base-components/BaseInput.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "compilerOptions": { 4 | "allowJs": true, 5 | "module": "ESNext", 6 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 7 | "moduleResolution": "Node", 8 | "target": "esnext", 9 | "jsx": "preserve", 10 | "strict": true, 11 | "esModuleInterop": true, 12 | "skipLibCheck": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "noEmit": true, 15 | "isolatedModules": true, 16 | "types": ["vite/client"] 17 | }, 18 | "exclude": ["node_modules", "public"], 19 | "include": [ 20 | "resources/js/**/*.ts", 21 | "resources/js/**/*.d.ts", 22 | "resources/js/**/*.vue", 23 | "resources/js/app.ts", "public/worker/arrayWorker.js", 24 | ], 25 | 26 | } -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | addDays(15)); 26 | Passport::refreshTokensExpireIn(now()->addDays(30)); 27 | Passport::personalAccessTokensExpireIn(now()->addMonths(6)); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Listeners/SendEmailVerification.php: -------------------------------------------------------------------------------- 1 | user->email 29 | Mail::to($event->user->email)->send(new SendMail($event->user)); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2024_11_05_024923_create_joinees_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('projectId'); 17 | $table->integer('userId'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('joinees'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/H2Icon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /database/migrations/2024_11_01_194659_create_drawings_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('projectId'); 17 | $table->json('drawingData'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('drawings'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /resources/js/src/pages/auth/CallbackPage.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 29 | 30 | callback 31 | -------------------------------------------------------------------------------- /database/migrations/2024_11_01_194707_create_sticky_notes_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('projectId'); 17 | $table->json('stickyNoteData'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('sticky_notes'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/migrations/2024_11_01_194640_create_text_captions_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('projectId'); 17 | $table->json('textCaptionData'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('text_captions'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/migrations/2024_09_13_183423_create_oauth_personal_access_clients_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->uuid('client_id'); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('oauth_personal_access_clients'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2024_11_01_194650_create_mini_text_editors_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->integer('projectId'); 17 | $table->json('miniTextEditorData'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('mini_text_editors'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /resources/js/src/pages/auth/LoginPage.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Login with Google 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Document 9 | 10 | 11 | 12 | 13 | 25 | @vite([ 'resources/js/app.ts','resources/css/app.css']) 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /resources/js/src/components/icons/H3Icon.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/cursor/userMouse.ts: -------------------------------------------------------------------------------- 1 | import { ref } from "vue"; 2 | import { yDocStore } from "./../../../../../store/yDoc"; 3 | import { LoginResponseType } from "../../../../../helper/auth"; 4 | export function useShareUserCursor(userData:LoginResponseType|undefined) { 5 | 6 | 7 | function trackMousePosition(event: any) { 8 | const userName=userData?.user?.name 9 | yDocStore.mousePosition.x = event.clientX; 10 | yDocStore.mousePosition.y = event.clientY; 11 | yDocStore.mousePosition.userName = userName as string 12 | 13 | 14 | 15 | yDocStore.yMouse.set("x", event.clientX); 16 | yDocStore.yMouse.set("y", event.clientY); 17 | yDocStore.yMouse.set("userName", userName); 18 | 19 | 20 | 21 | 22 | } 23 | 24 | return { 25 | trackMousePosition, 26 | 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /database/migrations/2024_09_13_183421_create_oauth_refresh_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->string('access_token_id', 100)->index(); 17 | $table->boolean('revoked'); 18 | $table->dateTime('expires_at')->nullable(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('oauth_refresh_tokens'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/migrations/2024_10_26_083709_create_projects_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | 17 | $table->string('name'); 18 | $table->string('image')->nullable(); 19 | $table->string('projectCode'); 20 | $table->integer('userId'); 21 | $table->string('projectLink'); 22 | 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | */ 30 | public function down(): void 31 | { 32 | Schema::dropIfExists('projects'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/BlinkingCursor.vue: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 21 | {{ yDocStore.cursor.typingUser }} 22 | 23 | 24 | -------------------------------------------------------------------------------- /resources/js/src/helper/auth.ts: -------------------------------------------------------------------------------- 1 | export type LoginResponseType = { 2 | user?: { 3 | name?: string 4 | email: string 5 | userId: string 6 | } 7 | authorizationCode?: string 8 | state?: string 9 | codeVerifier?: string 10 | token?: { 11 | accessToken: string 12 | refreshToken: string 13 | } 14 | 15 | } 16 | 17 | 18 | export function setUserData(data: LoginResponseType) { 19 | localStorage.setItem('userData', JSON.stringify(data)) 20 | } 21 | 22 | export function getUserData(): LoginResponseType | undefined { 23 | try { 24 | const userData: string | null = localStorage.getItem('userData') 25 | 26 | if (typeof userData !== 'object') { 27 | const loginData: LoginResponseType = JSON.parse(userData) 28 | return loginData 29 | } 30 | } catch (error) { 31 | console.log((error as Error).message) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/LearnYjs.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | Click here bro 31 | 32 | 33 | 34 | users messages:{{ messages }} 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /database/migrations/2024_09_13_183419_create_oauth_auth_codes_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->unsignedBigInteger('user_id')->index(); 17 | $table->uuid('client_id'); 18 | $table->text('scopes')->nullable(); 19 | $table->boolean('revoked'); 20 | $table->dateTime('expires_at')->nullable(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('oauth_auth_codes'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie', 'oauth/*'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /resources/views/about.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | EVENT DELEGATION 12 | 13 | 14 | Item 1 15 | Item 2 16 | Item 3 17 | 18 | 19 | 20 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | import { fileURLToPath, URL } from 'url'; 5 | 6 | export default defineConfig({ 7 | plugins: [ 8 | laravel({ 9 | input: ['resources/css/app.css', 'resources/js/app.ts'], 10 | refresh: true, 11 | }), 12 | vue(), 13 | ], 14 | 15 | resolve: { 16 | alias: { 17 | '@': fileURLToPath(new URL('./src', import.meta.url)) // Correctly resolve file paths 18 | } 19 | }, 20 | 21 | // server: { 22 | // proxy: { 23 | // // Proxy Web Worker requests to your backend at port 8000 24 | // '/worker': { 25 | // target: 'http://127.0.0.1:8000', // Your Laravel backend 26 | // changeOrigin: true, 27 | // rewrite: (path) => path.replace(/^\/worker/, '/js') // Rewrite if needed 28 | // } 29 | // } 30 | // } 31 | }); 32 | -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000001_create_cache_table.php: -------------------------------------------------------------------------------- 1 | string('key')->primary(); 16 | $table->mediumText('value'); 17 | $table->integer('expiration'); 18 | }); 19 | 20 | Schema::create('cache_locks', function (Blueprint $table) { 21 | $table->string('key')->primary(); 22 | $table->string('owner'); 23 | $table->integer('expiration'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | */ 30 | public function down(): void 31 | { 32 | Schema::dropIfExists('cache'); 33 | Schema::dropIfExists('cache_locks'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2024_05_23_122432_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->morphs('tokenable'); 17 | $table->string('name'); 18 | $table->string('token', 64)->unique(); 19 | $table->text('abilities')->nullable(); 20 | $table->timestamp('last_used_at')->nullable(); 21 | $table->timestamp('expires_at')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('personal_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2024_09_13_183420_create_oauth_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->unsignedBigInteger('user_id')->nullable()->index(); 17 | $table->uuid('client_id'); 18 | $table->string('name')->nullable(); 19 | $table->text('scopes')->nullable(); 20 | $table->boolean('revoked'); 21 | $table->timestamps(); 22 | $table->dateTime('expires_at')->nullable(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('oauth_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /resources/js/app.ts: -------------------------------------------------------------------------------- 1 | import "./bootstrap"; 2 | 3 | import { createApp } from "vue"; 4 | import App from "./src/App.vue"; 5 | import router from "./src/router/index"; 6 | import { createPinia } from "pinia"; 7 | import ToastPlugin from 'vue-toast-notification' 8 | import 'vue-toast-notification/dist/theme-bootstrap.css' 9 | 10 | const importIcons = import.meta.glob("./src/components/icons/**/*.vue"); 11 | 12 | 13 | 14 | async function registerIcons(app: any) { 15 | for (const filePath of Object.keys(importIcons)) { 16 | const fileArray = filePath.split("/"); 17 | const fileName = fileArray.pop(); 18 | const realFileName = fileName?.replace(".vue", ""); 19 | 20 | importIcons[filePath]() 21 | .then(function (data) { 22 | app.component(realFileName, (data as any).default); 23 | 24 | }) 25 | .catch((error) => console.log(error)); 26 | } 27 | } 28 | 29 | 30 | 31 | const app = createApp(App); 32 | app.use(router); 33 | app.use(createPinia()); 34 | app.use(ToastPlugin) 35 | 36 | registerIcons(app); 37 | app.mount("#app"); 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project/UserMenu.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 18 | 19 | {{ user?.user?.name }} 20 | 21 | {{ user?.user?.email }} 22 | 23 | 24 | 28 | 29 | 30 | 31 | Logout 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app/Events/UserTypingEvent.php: -------------------------------------------------------------------------------- 1 | receiverId = $receiverId; 25 | } 26 | 27 | /** 28 | * Get the channels the event should broadcast on. 29 | * 30 | * @return array 31 | */ 32 | public function broadcastOn(): Channel 33 | { 34 | 35 | // Single channel 36 | return new PrivateChannel("typing.{$this->receiverId}"); 37 | 38 | 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | withRouting( 12 | web: __DIR__.'/../routes/web.php', 13 | api: __DIR__.'/../routes/api.php', 14 | commands: __DIR__.'/../routes/console.php', 15 | channels: __DIR__.'/../routes/channels.php', 16 | health: '/up', 17 | ) 18 | ->withMiddleware(function (Middleware $middleware) { 19 | // 20 | }) 21 | ->withExceptions(function (Exceptions $exceptions) { 22 | 23 | $exceptions->render(function (RouteNotFoundException $e, Request $request){ 24 | if($request->is('api/*')){ 25 | return response()->json([ 26 | 'message' => 'Not authenticated', 27 | 'status' =>401 28 | ],404); 29 | } 30 | }); 31 | })->create(); 32 | -------------------------------------------------------------------------------- /database/migrations/2024_09_13_183422_create_oauth_clients_table.php: -------------------------------------------------------------------------------- 1 | uuid('id')->primary(); 16 | $table->unsignedBigInteger('user_id')->nullable()->index(); 17 | $table->string('name'); 18 | $table->string('secret', 100)->nullable(); 19 | $table->string('provider')->nullable(); 20 | $table->text('redirect'); 21 | $table->boolean('personal_access_client'); 22 | $table->boolean('password_client'); 23 | $table->boolean('revoked'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | */ 31 | public function down(): void 32 | { 33 | Schema::dropIfExists('oauth_clients'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project/http/getProject.ts: -------------------------------------------------------------------------------- 1 | import { ref } from 'vue' 2 | import { makeHttpReq2 } from '../../../../../helper/makeHttpReq'; 3 | import { getUserData } from '../../../../../helper/auth'; 4 | 5 | export interface IProjectList { 6 | id: number 7 | name: string 8 | projectCode: string 9 | projectLink: string 10 | userId:number 11 | 12 | } 13 | 14 | export type ProjectListResponseType = { data: Array } 15 | 16 | export function useGetProject() { 17 | const loading = ref(false) 18 | const serverData = ref({} as ProjectListResponseType) 19 | const userData=getUserData() 20 | const userId=userData?.user?.userId 21 | 22 | async function getProjects(page=1) { 23 | try { 24 | loading.value = true 25 | const data = await makeHttpReq2(`projects?page=${page}&userId=${userId}`, 'GET') 26 | serverData.value = data 27 | loading.value = false 28 | } catch (error) { 29 | console.error(error) 30 | loading.value = false 31 | } 32 | } 33 | 34 | return { getProjects, serverData, loading } 35 | } 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /resources/js/src/components/base-components/LoadingIndicator.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | Loading document... 11 | 12 | 13 | 14 | 15 | 49 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/UndoRedo.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | /** 15 | * The current password being used by the factory. 16 | */ 17 | protected static ?string $password; 18 | 19 | /** 20 | * Define the model's default state. 21 | * 22 | * @return array 23 | */ 24 | public function definition(): array 25 | { 26 | return [ 27 | 'name' => fake()->name(), 28 | 'email' => fake()->unique()->safeEmail(), 29 | 'email_verified_at' => now(), 30 | 'password' => static::$password ??= Hash::make('password'), 31 | 'remember_token' => Str::random(10), 32 | ]; 33 | } 34 | 35 | /** 36 | * Indicate that the model's email address should be unverified. 37 | */ 38 | public function unverified(): static 39 | { 40 | return $this->state(fn (array $attributes) => [ 41 | 'email_verified_at' => null, 42 | ]); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | session()->pull('state'); 37 | 38 | $codeVerifier = $request->session()->pull('code_verifier'); 39 | 40 | throw_unless( 41 | strlen($state) > 0 && $state === $request->state, 42 | InvalidArgumentException::class 43 | ); 44 | 45 | $user=Auth::user(); 46 | //redirect to the client to request for code 47 | return redirect('http://127.0.0.1:8000/app/token?user_id='.$user->id.'&code_verifier='.$codeVerifier); 48 | }); 49 | 50 | 51 | Route::get('/login', function() { 52 | return redirect('/auth/redirect'); 53 | })->name('login'); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "type": "module", 4 | "scripts": { 5 | "dev": "vite", 6 | "build": "vue-tsc --noEmit && vite build", 7 | "build-css": "tailwindcss -i ./resources/css/input.css -o ./resources/css/app.css -w" 8 | }, 9 | "devDependencies": { 10 | "@vitejs/plugin-vue": "^5.0.4", 11 | "axios": "^1.6.4", 12 | "laravel-echo": "^1.16.1", 13 | "laravel-vite-plugin": "^1.0", 14 | "pusher-js": "^8.4.0-rc2", 15 | "typescript": "^5.4.5", 16 | "vite": "^5.0", 17 | "vue-tsc": "^2.0.19" 18 | }, 19 | "dependencies": { 20 | "@vuelidate/core": "^2.0.3", 21 | "@vuelidate/validators": "^2.0.4", 22 | "apexcharts": "^3.49.1", 23 | "autoprefixer": "^10.4.20", 24 | "laravel-vue-pagination": "^4.1.3", 25 | "pinia": "^2.1.7", 26 | "postcss": "^8.4.47", 27 | "tailwindcss": "^3.4.11", 28 | "vue": "^3.4.27", 29 | "vue-router": "^4.3.2", 30 | "vue-sweetalert2": "^5.0.10", 31 | "vue-toast-notification": "^3.1.2", 32 | "vue3-apexcharts": "^1.5.3", 33 | "y-indexeddb": "^9.0.12", 34 | "y-webrtc": "^10.3.0", 35 | "y-websocket": "^2.0.4", 36 | "yjs": "^13.6.19" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | 16 | 17 | app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'client_id' => env('GOOGLE_CLIENT_ID'), 20 | 'client_secret' => env('GOOGLE_CLIENT_SECRET'), 21 | 'redirect' => env('GOOGLE_CLIENT_CALLBACK'), 22 | ], 23 | 24 | 25 | 'postmark' => [ 26 | 'token' => env('POSTMARK_TOKEN'), 27 | ], 28 | 29 | 'ses' => [ 30 | 'key' => env('AWS_ACCESS_KEY_ID'), 31 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 32 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 33 | ], 34 | 35 | 'resend' => [ 36 | 'key' => env('RESEND_KEY'), 37 | ], 38 | 39 | 'slack' => [ 40 | 'notifications' => [ 41 | 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), 42 | 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), 43 | ], 44 | ], 45 | 46 | ]; 47 | -------------------------------------------------------------------------------- /resources/js/src/router/index.ts: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from "vue-router"; 2 | 3 | const router = createRouter({ 4 | // http://127.0.0.1:8000/about 5 | // http://127.0.0.1:8000/app/login 6 | history: createWebHistory("/app"), 7 | routes: [ 8 | { 9 | path: "/login", 10 | name: "login", 11 | component: () => import("../pages/auth/LoginPage.vue"), 12 | }, 13 | { 14 | path: "/projects", 15 | name: "projects", 16 | component: () => import("../pages/admin/ProjectPage.vue"), 17 | }, 18 | { 19 | path: "/project-boards", 20 | name: "project-board", 21 | component: () => import("../pages/admin/ProjectBoardPage.vue"), 22 | }, 23 | 24 | { 25 | path: "/token", 26 | name: "token", 27 | component: () => import("../pages/auth/TokenPage.vue"), 28 | }, 29 | { 30 | path: "/callback", 31 | name: "callback", 32 | component: () => import("../pages/auth/CallbackPage.vue"), 33 | }, 34 | { 35 | path: "/learn-yjs", 36 | name: "learn-yjs", 37 | component: () => import("../pages/admin/LearnYjs.vue"), 38 | }, 39 | 40 | { 41 | path: "/add_joinees", 42 | name: "add_joinees", 43 | component: () => import("../pages/admin/addJoinee.vue"), 44 | }, 45 | ], 46 | }); 47 | 48 | export default router; 49 | -------------------------------------------------------------------------------- /app/Mail/SendMail.php: -------------------------------------------------------------------------------- 1 | user=$user; 25 | } 26 | 27 | /** 28 | * Get the message envelope. 29 | */ 30 | public function envelope(): Envelope 31 | { 32 | return new Envelope( 33 | from:new Address('admin@mail.com','Task App'), 34 | subject: 'Email verification', 35 | ); 36 | } 37 | 38 | /** 39 | * Get the message content definition. 40 | */ 41 | public function content(): Content 42 | { 43 | return new Content( 44 | view: 'email.email-verification', 45 | with:['user'=>$this->user] 46 | ); 47 | } 48 | 49 | /** 50 | * Get the attachments for the message. 51 | * 52 | * @return array 53 | */ 54 | public function attachments(): array 55 | { 56 | return []; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | ['auth:api']], function () { 14 | 15 | Route::post('/logout', [AuthController::class, 'logout']); 16 | 17 | 18 | Route::controller(ProjectController::class)->group(function () { 19 | 20 | Route::post('/projects', 'createProject'); 21 | Route::put('/projects', 'updateProject'); 22 | Route::get('/projects', 'getProjects'); 23 | Route::get('/projects/detail', 'getProjectDetail'); 24 | 25 | 26 | }); 27 | 28 | 29 | Route::controller(ProjectBoardController::class)->group(function () { 30 | 31 | Route::post('/mini_text_editors', 'createOrUpdateMiniTextEditor'); 32 | Route::post('/sticky_notes', 'createOrUpdateStickyNote'); 33 | Route::post('/drawings', 'createOrUpdateDrawing'); 34 | Route::post('/text_captions', 'createOrUpdateTextCaption'); 35 | Route::get('/project_boards', 'getProjectBoardData'); 36 | Route::post('/joinees', 'addJoinees'); 37 | 38 | }); 39 | 40 | 41 | 42 | 43 | 44 | }); 45 | 46 | 47 | Route::get('/user', function (Request $request) { 48 | return $request->user(); 49 | })->middleware('auth:sanctum'); 50 | -------------------------------------------------------------------------------- /app/Events/ProjectBoardEvent.php: -------------------------------------------------------------------------------- 1 | projectCode = $projectCode; 25 | } 26 | 27 | /** 28 | * Get the channels the event should broadcast on. 29 | * 30 | * @return array 31 | */ 32 | public function broadcastOn(): Channel 33 | { 34 | // This method is responsible for returning 35 | // the channel that the event should broadcast on 36 | 37 | //broadcast on multiple channels 38 | // return [ 39 | // new PrivateChannel("channel-name"), 40 | // ]; 41 | 42 | // Single channel 43 | return new PresenceChannel("project.room.{$this->projectCode}"); 44 | 45 | 46 | 47 | 48 | //public channel 49 | 50 | // we pass only 51 | // return new Channel('channel-name') 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/JoinningUsersModal.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | Users 19 | 20 | 21 | 22 | 25 | 26 | {{user.name}} - {{user.email}} 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | Close 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/js/src/components/base-components/BaseModal.vue: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/addjoinee/http/addJoinee.ts: -------------------------------------------------------------------------------- 1 | import { RouteLocationNormalizedLoaded } from "vue-router"; 2 | import { ref } from 'vue' 3 | import { makeHttpReq, makeHttpReq2 } from '../../../../../helper/makeHttpReq'; 4 | import { getUserData } from "../../../../../helper/auth"; 5 | import { App } from "../../../../../app/app"; 6 | import { showError } from "../../../../../helper/toastnotification"; 7 | 8 | 9 | 10 | export function useAddJoinees(route: RouteLocationNormalizedLoaded){ 11 | 12 | const loading=ref(false) 13 | const userData=getUserData() 14 | const projectCode=route?.query?.project_code as string 15 | 16 | async function addJoinees(){ 17 | 18 | 19 | try { 20 | loading.value = true 21 | const data = await makeHttpReq2<{ 22 | projectCode:string 23 | userId:string 24 | }, { 25 | message:string, 26 | status:boolean 27 | }> 28 | (`joinees`, 'POST',{ 29 | projectCode:projectCode, 30 | userId:userData?.user?.userId as string 31 | }) 32 | 33 | if(data.status){ 34 | // http://127.0.0.1:8000/app/add_joinees?project_code=BJDfgJLrje-1730775993 35 | // http://127.0.0.1:8000/app/project-boards?project_code=BJDfgJLrje-1730775993 36 | window.location.href=App.baseUrl+'/app/project-boards?project_code='+projectCode 37 | } 38 | loading.value = false 39 | } catch (error) { 40 | showError((error as Error).message) 41 | loading.value = false 42 | } 43 | 44 | } 45 | 46 | 47 | return {addJoinees,loading} 48 | } -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('name')->nullable(); 17 | $table->string('email')->unique(); 18 | $table->timestamp('email_verified_at')->nullable(); 19 | $table->string('googleId'); 20 | $table->string('password')->nullable(); 21 | $table->rememberToken(); 22 | $table->timestamps(); 23 | }); 24 | 25 | Schema::create('password_reset_tokens', function (Blueprint $table) { 26 | $table->string('email')->primary(); 27 | $table->string('token'); 28 | $table->timestamp('created_at')->nullable(); 29 | }); 30 | 31 | Schema::create('sessions', function (Blueprint $table) { 32 | $table->string('id')->primary(); 33 | $table->foreignId('user_id')->nullable()->index(); 34 | $table->string('ip_address', 45)->nullable(); 35 | $table->text('user_agent')->nullable(); 36 | $table->longText('payload'); 37 | $table->integer('last_activity')->index(); 38 | }); 39 | } 40 | 41 | /** 42 | * Reverse the migrations. 43 | */ 44 | public function down(): void 45 | { 46 | Schema::dropIfExists('users'); 47 | Schema::dropIfExists('password_reset_tokens'); 48 | Schema::dropIfExists('sessions'); 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY=base64:ASPFcMWDorc+27kT/5yrmGBjhJNLDoXsp6jaeYTjD6M= 4 | APP_DEBUG=true 5 | APP_TIMEZONE=UTC 6 | APP_URL=http://localhost 7 | 8 | APP_LOCALE=en 9 | APP_FALLBACK_LOCALE=en 10 | APP_FAKER_LOCALE=en_US 11 | 12 | APP_MAINTENANCE_DRIVER=file 13 | APP_MAINTENANCE_STORE=database 14 | 15 | BCRYPT_ROUNDS=12 16 | 17 | LOG_CHANNEL=stack 18 | LOG_STACK=single 19 | LOG_DEPRECATIONS_CHANNEL=null 20 | LOG_LEVEL=debug 21 | 22 | DB_CONNECTION=mysql 23 | DB_HOST=127.0.0.1 24 | DB_PORT=3306 25 | DB_DATABASE=real_time_app 26 | DB_USERNAME=root 27 | DB_PASSWORD= 28 | 29 | SESSION_DRIVER=database 30 | SESSION_LIFETIME=120 31 | SESSION_ENCRYPT=false 32 | SESSION_PATH=/ 33 | SESSION_DOMAIN=null 34 | 35 | BROADCAST_CONNECTION=reverb 36 | FILESYSTEM_DISK=local 37 | QUEUE_CONNECTION=database 38 | 39 | CACHE_STORE=database 40 | CACHE_PREFIX= 41 | 42 | MEMCACHED_HOST=127.0.0.1 43 | 44 | REDIS_CLIENT=phpredis 45 | REDIS_HOST=127.0.0.1 46 | REDIS_PASSWORD=null 47 | REDIS_PORT=6379 48 | 49 | MAIL_MAILER=smtp 50 | MAIL_HOST=127.0.0.1 51 | MAIL_PORT=1025 52 | # MAIL_PORT=465 53 | 54 | MAIL_USERNAME=null 55 | MAIL_PASSWORD=null 56 | MAIL_ENCRYPTION=null 57 | MAIL_FROM_ADDRESS="hello@example.com" 58 | MAIL_FROM_NAME="${APP_NAME}" 59 | 60 | AWS_ACCESS_KEY_ID= 61 | AWS_SECRET_ACCESS_KEY= 62 | AWS_DEFAULT_REGION=us-east-1 63 | AWS_BUCKET= 64 | AWS_USE_PATH_STYLE_ENDPOINT=false 65 | 66 | VITE_APP_NAME="${APP_NAME}" 67 | 68 | 69 | REVERB_APP_ID=149166 70 | REVERB_APP_KEY=rqstow4sbplqshtxxkak 71 | REVERB_APP_SECRET=9hon33i81fj34x4zawz4 72 | REVERB_HOST="localhost" 73 | REVERB_PORT=8080 74 | REVERB_SCHEME=http 75 | 76 | VITE_REVERB_APP_KEY="${REVERB_APP_KEY}" 77 | VITE_REVERB_HOST="${REVERB_HOST}" 78 | VITE_REVERB_PORT="${REVERB_PORT}" 79 | VITE_REVERB_SCHEME="${REVERB_SCHEME}" 80 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | $googleUser->id, 29 | ], [ 30 | 'name' => $googleUser->name, 31 | 'email' => $googleUser->email, 32 | 'googleId' => $googleUser->id, 33 | 'password' => Hash::make($password) 34 | ]); 35 | 36 | return $user; 37 | 38 | } 39 | 40 | 41 | 42 | 43 | /** 44 | * The attributes that are mass assignable. 45 | * 46 | * @var array 47 | */ 48 | protected $fillable = [ 49 | 'name', 50 | 'email', 51 | 'googleId', 52 | ]; 53 | 54 | /** 55 | * The attributes that should be hidden for serialization. 56 | * 57 | * @var array 58 | */ 59 | protected $hidden = [ 60 | 'password', 61 | // 'remember_token', 62 | ]; 63 | 64 | /** 65 | * Get the attributes that should be cast. 66 | * 67 | * @return array 68 | */ 69 | protected function casts(): array 70 | { 71 | return [ 72 | 'email_verified_at' => 'datetime', 73 | 'password' => 'hashed', 74 | ]; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Todo.md: -------------------------------------------------------------------------------- 1 | 2 | MIRO CLONE 3 | 4 | 5 | ______________________________________ 6 | INSTALLATION 7 | 8 | 1. Laravel 9 | 10 | 2. php artisan install:api 11 | 12 | 3. php artisan install:broadcasting. 13 | 14 | - you will be prompted to install == laravel reverb == 15 | - This command install ==laravel-echo and pusher-js == 16 | 17 | 4. publish reverb config file -> php artisan reverb:install 18 | 19 | 5. next type "npm run build" to compile your application's assets 20 | 21 | -------------------------------- FRONTED SETUP 22 | 23 | 1. npm i -D @vitejs/plugin-vue 24 | 25 | 1. npm i vue@latest 26 | 27 | 2. npm i vue-router@4 28 | 29 | 3. npm i -D typescript vue-tsc 30 | 31 | 4. create tsconfig.ts file 32 | 33 | 4. tailwind css 34 | 35 | --------------------------------------------------------------- 36 | 37 | 38 | DATABASE STRUCTURE 39 | users 40 | - name 41 | - email 42 | - googleId 43 | endpoints : [login/create] 44 | 45 | 46 | projects 47 | - name 48 | - image 49 | - projectCode (uniqueId str 10) 50 | - userId (project owner) 51 | - projectLink 52 | 53 | 54 | [StickyNote,Drawing,MiniTextEditor,TextCaption] 55 | 56 | projectStickyNote 57 | - projectId 58 | - stickyNoteData (json) 59 | 60 | $table->integer('projectId'); 61 | $table->json('stickyNoteData'); 62 | 63 | projectDrawing 64 | - projectId 65 | - drawingData (json) 66 | 67 | $table->integer('projectId'); 68 | $table->json('drawingData'); 69 | 70 | 71 | projectMiniTextEditor 72 | - projectId 73 | - editorData (json) 74 | 75 | $table->integer('projectId'); 76 | $table->json('editorData'); 77 | 78 | projectTextCaption 79 | - projectId 80 | - textCaptionData (json) 81 | 82 | $table->integer('projectId'); 83 | $table->json('textCaptionData'); 84 | 85 | projectJoinees 86 | - projectId 87 | - userId (joinee) 88 | 89 | $table->integer('projectId'); 90 | $table->integer('userId'); 91 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/ColorPalette.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 31 | 35 | 39 | 43 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /resources/js/src/store/yDoc.ts: -------------------------------------------------------------------------------- 1 | import { defineStore } from "pinia"; 2 | import * as Y from "yjs"; 3 | import { IMiniTextEditor } from "../pages/admin/actions/project-board/editor/miniTextEditorTypes"; 4 | import { IStickyNote } from "../pages/admin/actions/project-board/stickynote/stickyNoteTypes"; 5 | import { ITextCaption } from "../pages/admin/actions/project-board/text-caption/textCaptionTypes"; 6 | import { userResponseType } from "../pages/auth/actions/tokenTypes"; 7 | export interface ICursor { 8 | cursorPosition: number; 9 | x: string; 10 | y: string; 11 | } 12 | 13 | export interface IReplayDrawing { 14 | x: number; 15 | y: number; 16 | type: "start" | "drawing"; 17 | strokeStyle: string; 18 | } 19 | 20 | const useYDocStore = defineStore("y-doc", { 21 | state: () => ({ 22 | doc: new Y.Doc(), 23 | miniTextEditor: [] as IMiniTextEditor[], 24 | yArrayMiniTextEditor: new Y.Array(), 25 | 26 | mousePosition: { 27 | userName:'', 28 | x: 0, 29 | y: 0, 30 | }, 31 | yMouse: new Y.Map(), 32 | 33 | yCursor: new Y.Map(), 34 | cursor: { 35 | typingUser:'', 36 | cursorPosition: 0, 37 | x: "", 38 | y: "", 39 | }, 40 | 41 | yArrayDrawing: new Y.Array>(), 42 | arrayDrawing: [] as Array>, 43 | //we use it as history 44 | redoDrawingArray: [] as Array>, 45 | 46 | loading: false, 47 | 48 | 49 | 50 | stickyNote:[] as IStickyNote[], 51 | yArrayStickyNote: new Y.Array(), 52 | 53 | yArrayTextCaption:new Y.Array(), 54 | textCaption:[] as ITextCaption[], 55 | 56 | 57 | //users 58 | joinees:[] as Array 59 | 60 | 61 | 62 | }), 63 | }); 64 | 65 | export const yDocStore = useYDocStore(); 66 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/http/saveBoardData.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import { ref } from "vue" 5 | import { makeHttpReq2 } from "../../../../../helper/makeHttpReq" 6 | import { IReplayDrawing } from "../../../../../store/yDoc" 7 | import { IMiniTextEditor } from "../editor/miniTextEditorTypes" 8 | import { IStickyNote } from "../stickynote/stickyNoteTypes" 9 | import { ITextCaption } from "../text-caption/textCaptionTypes" 10 | import { showError, successMsg } from "../../../../../helper/toastnotification" 11 | 12 | 13 | export function useSaveBoardData( arrayDrawing: IReplayDrawing[][],miniTextEditor: IMiniTextEditor[], 14 | stickyNote:IStickyNote[] ,textCaption:ITextCaption[] , 15 | projectId:number 16 | ) { 17 | const loading = ref(false) 18 | 19 | async function saveBoardData() { 20 | try { 21 | loading.value = true 22 | 23 | //save drawingData 24 | makeHttpReq2<{drawingData:IReplayDrawing[][],projectId:number}, ResponseType>('drawings', 'POST', {drawingData:arrayDrawing,projectId:projectId}) 25 | 26 | // //save MiniTextEditor 27 | makeHttpReq2<{miniTextEditorData:IMiniTextEditor[],projectId:number}, ResponseType>('mini_text_editors', 'POST', {miniTextEditorData:miniTextEditor,projectId:projectId}) 28 | 29 | //save stickyNote 30 | makeHttpReq2<{stickyNoteData:IStickyNote[],projectId:number}, ResponseType>('sticky_notes', 'POST', {stickyNoteData:stickyNote,projectId:projectId}) 31 | 32 | //save TextCaption 33 | makeHttpReq2<{textCaptionData:ITextCaption[],projectId:number}, ResponseType>('text_captions', 'POST', {textCaptionData:textCaption,projectId:projectId}) 34 | 35 | 36 | 37 | successMsg('Board data saved successfully !') 38 | 39 | loading.value = false 40 | } catch (error) { 41 | console.log(error) 42 | loading.value = false 43 | showError((error as Error).message) 44 | } 45 | } 46 | 47 | return {saveBoardData , loading } 48 | } 49 | 50 | 51 | -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000002_create_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('queue')->index(); 17 | $table->longText('payload'); 18 | $table->unsignedTinyInteger('attempts'); 19 | $table->unsignedInteger('reserved_at')->nullable(); 20 | $table->unsignedInteger('available_at'); 21 | $table->unsignedInteger('created_at'); 22 | }); 23 | 24 | Schema::create('job_batches', function (Blueprint $table) { 25 | $table->string('id')->primary(); 26 | $table->string('name'); 27 | $table->integer('total_jobs'); 28 | $table->integer('pending_jobs'); 29 | $table->integer('failed_jobs'); 30 | $table->longText('failed_job_ids'); 31 | $table->mediumText('options')->nullable(); 32 | $table->integer('cancelled_at')->nullable(); 33 | $table->integer('created_at'); 34 | $table->integer('finished_at')->nullable(); 35 | }); 36 | 37 | Schema::create('failed_jobs', function (Blueprint $table) { 38 | $table->id(); 39 | $table->string('uuid')->unique(); 40 | $table->text('connection'); 41 | $table->text('queue'); 42 | $table->longText('payload'); 43 | $table->longText('exception'); 44 | $table->timestamp('failed_at')->useCurrent(); 45 | }); 46 | } 47 | 48 | /** 49 | * Reverse the migrations. 50 | */ 51 | public function down(): void 52 | { 53 | Schema::dropIfExists('jobs'); 54 | Schema::dropIfExists('job_batches'); 55 | Schema::dropIfExists('failed_jobs'); 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project/ProjectList.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 19 | 20 | 21 | 25 | 33 | 38 | 39 | 40 | 41 | 42 | {{ project.name }} 43 | 44 | 45 | 46 | Details 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/AddItem.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 17 | 18 | 19 | 20 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/StickyNote.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 31 | 32 | 36 | 37 | 38 | 39 | 45 | 46 | 47 | 48 | 54 | {{ stickyNote.body }} 55 | 56 | 57 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/TextCaption.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 30 | 31 | 35 | 36 | 37 | 38 | 44 | 45 | 46 | 47 | 53 | {{ textCaption.body }} 54 | 55 | 56 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project/http/createOrUpdateProject.ts: -------------------------------------------------------------------------------- 1 | import { ref } from "vue" 2 | import { useProjectStore } from "../../../../../store/projectStore" 3 | import { showError, successMsg } from "../../../../../helper/toastnotification" 4 | import { getUserData } from "../../../../../helper/auth" 5 | import { makeHttpReq2 } from "../../../../../helper/makeHttpReq" 6 | import { useGetProject } from "./getProject" 7 | 8 | 9 | 10 | 11 | export interface ICreateOrUpdateProject { 12 | id: number | null 13 | name: string 14 | userId: number | null 15 | } 16 | 17 | type ResponseType = { message: string } 18 | 19 | const projectInput = useProjectStore() 20 | 21 | 22 | export function useCreateOrUpdateProject() { 23 | const loading = ref(false) 24 | 25 | async function createOrUpdateProject( 26 | input: ICreateOrUpdateProject, 27 | edit: boolean 28 | ) { 29 | try { 30 | const userData = getUserData() 31 | loading.value = true 32 | projectInput.input.userId = parseInt(userData?.user?.userId as string) 33 | const data = edit ? await update('projects', input) : await create('projects', input) 34 | projectInput.edit=false 35 | projectInput.input = {} as ICreateOrUpdateProject 36 | 37 | 38 | successMsg(data.message) 39 | 40 | loading.value = false 41 | } catch (error) { 42 | if (typeof (error as { errors: Array }).errors !== 'undefined') { 43 | for (const message of (error as { errors: Array }).errors) { 44 | showError(message) 45 | } 46 | } 47 | 48 | loading.value = false 49 | showError((error as Error).message) 50 | } 51 | } 52 | 53 | return {createOrUpdateProject , loading } 54 | } 55 | 56 | async function create(url: string, input: ICreateOrUpdateProject) { 57 | const data = await makeHttpReq2(url, 'POST', input) 58 | return data 59 | } 60 | 61 | async function update(url: string, input: ICreateOrUpdateProject) { 62 | const data = await makeHttpReq2(url, 'PUT', input) 63 | return data 64 | } 65 | 66 | -------------------------------------------------------------------------------- /resources/js/src/pages/auth/actions/getToken.ts: -------------------------------------------------------------------------------- 1 | import { getUserData, setUserData } from "../../../helper/auth"; 2 | import { makeHttpReq, makeHttpReq2 } from "../../../helper/makeHttpReq"; 3 | import { showError } from "../../../helper/toastnotification"; 4 | import { 5 | OauthTokenInputType, 6 | OauthTokenResponseType, 7 | userResponseType, 8 | } from "./tokenTypes"; 9 | 10 | export async function getAccessTokenAndRefreshToken( 11 | codeVerifier: string, 12 | userId: string 13 | ) { 14 | const userData = getUserData(); 15 | 16 | try { 17 | const input: OauthTokenInputType = { 18 | grant_type: "authorization_code", 19 | client_id: "9d69c34f-da8d-4930-a760-cb24235ee151", 20 | redirect_uri: "http://127.0.0.1:8000/app/callback", 21 | code_verifier: codeVerifier, 22 | code: userData?.authorizationCode as string, 23 | }; 24 | //request access an refresh token 25 | const token = await makeHttpReq< 26 | OauthTokenInputType, 27 | OauthTokenResponseType 28 | >("oauth/token", "POST", input); 29 | const tokenProps = { 30 | accessToken: token?.access_token, 31 | refreshToken: token?.refresh_token, 32 | }; 33 | setUserData({ 34 | token: { 35 | ...tokenProps, 36 | }, 37 | }); 38 | 39 | //end request for the access and refresh token 40 | 41 | //requesting for the user data 42 | const { user } = await makeHttpReq2< 43 | { client_id: string; user_id: string }, 44 | { 45 | user: userResponseType; 46 | } 47 | >("user_data", "POST", { 48 | client_id: input.client_id, 49 | user_id: userId, 50 | }); 51 | 52 | setUserData({ 53 | user: { 54 | name: user?.name, 55 | email: user?.email, 56 | userId: user?.id, 57 | }, 58 | token: { 59 | ...tokenProps, 60 | }, 61 | }); 62 | 63 | window.location.href = "/app/projects"; 64 | //end request for the user data 65 | } catch (error) { 66 | showError((error as Error).message); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The skeleton application for the Laravel framework.", 5 | "keywords": ["laravel", "framework"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.2", 9 | "laravel/framework": "^11.0", 10 | "laravel/passport": "^12.0", 11 | "laravel/reverb": "@beta", 12 | "laravel/sanctum": "^4.0", 13 | "laravel/socialite": "^5.16", 14 | "laravel/tinker": "^2.9" 15 | }, 16 | "require-dev": { 17 | "fakerphp/faker": "^1.23", 18 | "laravel/pint": "^1.13", 19 | "laravel/sail": "^1.26", 20 | "mockery/mockery": "^1.6", 21 | "nunomaduro/collision": "^8.0", 22 | "phpunit/phpunit": "^11.0.1", 23 | "spatie/laravel-ignition": "^2.4" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "App\\": "app/", 28 | "Database\\Factories\\": "database/factories/", 29 | "Database\\Seeders\\": "database/seeders/" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Tests\\": "tests/" 35 | } 36 | }, 37 | "scripts": { 38 | "post-autoload-dump": [ 39 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 40 | "@php artisan package:discover --ansi" 41 | ], 42 | "post-update-cmd": [ 43 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 44 | ], 45 | "post-root-package-install": [ 46 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 47 | ], 48 | "post-create-project-cmd": [ 49 | "@php artisan key:generate --ansi", 50 | "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", 51 | "@php artisan migrate --graceful --ansi" 52 | ] 53 | }, 54 | "extra": { 55 | "laravel": { 56 | "dont-discover": [] 57 | } 58 | }, 59 | "config": { 60 | "optimize-autoloader": true, 61 | "preferred-install": "dist", 62 | "sort-packages": true, 63 | "allow-plugins": { 64 | "pestphp/pest-plugin": true, 65 | "php-http/discovery": true 66 | } 67 | }, 68 | "minimum-stability": "stable", 69 | "prefer-stable": true 70 | } 71 | -------------------------------------------------------------------------------- /public/img/google.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Group 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resources/js/src/helper/makeHttpReq.ts: -------------------------------------------------------------------------------- 1 | import { App } from "../app/app" 2 | import { getUserData } from "./auth" 3 | 4 | type HttpVerbType = 'GET' | 'POST' | 'PUT' | 'DELETE' 5 | 6 | /** 7 | * 8 | * @param message 9 | * @param timeout 10 seconds is better [you can change] 10 | * @returns 11 | */ 12 | export function httpTimeOut(message: string, timeout = 6000) { 13 | return new Promise((resolve, reject) => { 14 | setTimeout(() => { 15 | reject(new Error(message)) 16 | }, timeout) 17 | }) 18 | } 19 | 20 | export function makeHttpReq( 21 | endpoint: string, 22 | verb: HttpVerbType, 23 | input?: TInput 24 | ) { 25 | return new Promise(async (resolve, reject) => { 26 | try { 27 | const res = await Promise.race([ 28 | fetch(`${App.baseUrl}/${endpoint}`, { 29 | method: verb, 30 | headers: { 31 | 'content-type': 'application/json', 32 | Authorization: 'Bearer ' 33 | }, 34 | body: JSON.stringify(input) 35 | }), 36 | httpTimeOut('Server Error') 37 | ]) 38 | 39 | const data: TResponse = await (res as Response).json() 40 | 41 | if (!(res as Response).ok) { 42 | reject(data) 43 | } 44 | resolve(data) 45 | } catch (error) { 46 | reject(error) 47 | } 48 | }) 49 | } 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | export function makeHttpReq2( 67 | endpoint: string, 68 | verb: HttpVerbType, 69 | input?: TInput 70 | ) { 71 | 72 | const userData=getUserData() 73 | return new Promise(async (resolve, reject) => { 74 | try { 75 | 76 | const res = await Promise.race([ 77 | fetch(`${App.apiBaseUrl}/${endpoint}`, { 78 | method: verb, 79 | headers: { 80 | 'content-type': 'application/json', 81 | Authorization: 'Bearer '+userData?.token?.accessToken 82 | }, 83 | body: JSON.stringify(input) 84 | }), 85 | httpTimeOut('Server Error') 86 | ]) 87 | 88 | const data: TResponse = await (res as Response).json() 89 | 90 | if (!(res as Response).ok) { 91 | reject(data) 92 | } 93 | resolve(data) 94 | } catch (error) { 95 | reject(error) 96 | } 97 | }) 98 | } 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Below you may configure as many filesystem disks as necessary, and you 24 | | may even configure multiple disks for the same driver. Examples for 25 | | most supported storage drivers are configured here for reference. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthController.php: -------------------------------------------------------------------------------- 1 | where('client_id', $request->client_id) 27 | ->where('user_id', $request->user_id) 28 | ->first(); 29 | 30 | if (! is_null($loginUser)) { 31 | 32 | $userId = $loginUser->user_id; 33 | 34 | $user = User::where('id', $userId) 35 | ->select('id', 'name', 'email') 36 | ->first(); 37 | 38 | return response(['user' => $user]); 39 | 40 | 41 | 42 | } 43 | 44 | } 45 | 46 | 47 | public function redirectToGoogle() 48 | { 49 | return Socialite::driver('google')->redirect(); 50 | } 51 | 52 | 53 | public function createUserViaGoogle(Request $request) 54 | { 55 | $googleUser = Socialite::driver('google')->user(); 56 | 57 | $user = User::createUser($googleUser); 58 | 59 | 60 | Auth::login( $user); 61 | 62 | $request->session()->put('state', $state = Str::random(40)); 63 | 64 | $request->session()->put( 65 | 'code_verifier', $code_verifier = Str::random(128) 66 | ); 67 | 68 | $codeChallenge = strtr(rtrim( 69 | base64_encode(hash('sha256', $code_verifier, true)), '='), '+/', '-_'); 70 | 71 | $query = http_build_query([ 72 | 'client_id' => '9d69c34f-da8d-4930-a760-cb24235ee151', 73 | 'redirect_uri' => 'http://127.0.0.1:8000/app/callback', 74 | 'response_type' => 'code', 75 | 'scope' => '', 76 | 'state' => $state, 77 | 'code_challenge' => $codeChallenge, 78 | 'code_challenge_method' => 'S256', 79 | 'prompt' => 'login', // "none", "consent", or "login" 80 | ]); 81 | 82 | return redirect('/oauth/authorize?'.$query); 83 | 84 | } 85 | 86 | 87 | public function logout(Request $request) 88 | { 89 | 90 | DB::table('oauth_access_tokens') 91 | ->where('user_id', $request->userId) 92 | ->delete(); 93 | 94 | return response(['message' => 'user logged out']); 95 | } 96 | 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project/ProjectModal.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 46 | 47 | 48 | 49 | Create Project 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 65 | Close 66 | 67 | 72 | 73 | Saving... 74 | 75 | 76 | {{ projectInput.edit ? 'Update':'Save' }} 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /config/passport.php: -------------------------------------------------------------------------------- 1 | 'web', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Encryption Keys 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Passport uses encryption keys while generating secure access tokens for 24 | | your application. By default, the keys are stored as local files but 25 | | can be set via environment variables when that is more convenient. 26 | | 27 | */ 28 | 29 | 'private_key' => env('PASSPORT_PRIVATE_KEY'), 30 | 31 | 'public_key' => env('PASSPORT_PUBLIC_KEY'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Passport Database Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | By default, Passport's models will utilize your application's default 39 | | database connection. If you wish to use a different connection you 40 | | may specify the configured name of the database connection here. 41 | | 42 | */ 43 | 44 | 'connection' => env('PASSPORT_CONNECTION'), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Client UUIDs 49 | |-------------------------------------------------------------------------- 50 | | 51 | | By default, Passport uses auto-incrementing primary keys when assigning 52 | | IDs to clients. However, if Passport is installed using the provided 53 | | --uuids switch, this will be set to "true" and UUIDs will be used. 54 | | 55 | */ 56 | 57 | 'client_uuids' => true, 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Personal Access Client 62 | |-------------------------------------------------------------------------- 63 | | 64 | | If you enable client hashing, you should set the personal access client 65 | | ID and unhashed secret within your environment file. The values will 66 | | get used while issuing fresh personal access tokens to your users. 67 | | 68 | */ 69 | 70 | 'personal_access_client' => [ 71 | 'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'), 72 | 'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'), 73 | ], 74 | 75 | ]; 76 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/UserCursor.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 27 | {{yDocStore.mousePosition.userName}} 28 | 29 | 44 | 45 | 52 | 56 | 57 | 58 | 62 | 63 | 64 | 65 | 66 | 95 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/components/project-board/TopNavBar.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 40 | 41 | 42 | | {{ project?.name }} 44 | 45 | | 46 | 47 | 51 | 52 | Projects 53 | 54 | 55 | 56 | 57 | 58 | 59 | {{ convertLetterToUpperCase() }} 60 | 61 | 62 | +{{ yDocStore.joinees.length }} users 67 | 68 | 69 | 73 | 74 | Share 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_CONNECTION', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over WebSockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'reverb' => [ 34 | 'driver' => 'reverb', 35 | 'key' => env('REVERB_APP_KEY'), 36 | 'secret' => env('REVERB_APP_SECRET'), 37 | 'app_id' => env('REVERB_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('REVERB_HOST'), 40 | 'port' => env('REVERB_PORT', 443), 41 | 'scheme' => env('REVERB_SCHEME', 'https'), 42 | 'useTLS' => env('REVERB_SCHEME', 'https') === 'https', 43 | ], 44 | 'client_options' => [ 45 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 46 | ], 47 | ], 48 | 49 | 'pusher' => [ 50 | 'driver' => 'pusher', 51 | 'key' => env('PUSHER_APP_KEY'), 52 | 'secret' => env('PUSHER_APP_SECRET'), 53 | 'app_id' => env('PUSHER_APP_ID'), 54 | 'options' => [ 55 | 'cluster' => env('PUSHER_APP_CLUSTER'), 56 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 57 | 'port' => env('PUSHER_PORT', 443), 58 | 'scheme' => env('PUSHER_SCHEME', 'https'), 59 | 'encrypted' => true, 60 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 61 | ], 62 | 'client_options' => [ 63 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 64 | ], 65 | ], 66 | 67 | 'ably' => [ 68 | 'driver' => 'ably', 69 | 'key' => env('ABLY_KEY'), 70 | ], 71 | 72 | 'log' => [ 73 | 'driver' => 'log', 74 | ], 75 | 76 | 'null' => [ 77 | 'driver' => 'null', 78 | ], 79 | 80 | ], 81 | 82 | ]; 83 | -------------------------------------------------------------------------------- /resources/js/src/yjs/yjs.ts: -------------------------------------------------------------------------------- 1 | import * as Y from "yjs"; 2 | import { WebsocketProvider } from "y-websocket"; 3 | import { IndexeddbPersistence } from "y-indexeddb"; 4 | import { Ref } from "vue"; 5 | import { IStickyNote } from "../pages/admin/actions/project-board/stickynote/stickyNoteTypes"; 6 | import { yDocStore } from "../store/yDoc"; 7 | import { runFuncSequentially } from "../helper/util"; 8 | import { 9 | initCursor, 10 | initDrawing, 11 | initMiniTextEditor, 12 | initMouse, 13 | initStickyNote, 14 | initTextCaption, 15 | } from "./yjsUtil"; 16 | import { ITextCaption } from "../pages/admin/actions/project-board/text-caption/textCaptionTypes"; 17 | import { IProjectDetail } from "../pages/admin/actions/project-board/http/getProjectDetail"; 18 | 19 | export interface ITextCaptionParams { 20 | // yArrayTextCaption: Ref>; 21 | textCaptionHasEventSet: Set; 22 | changeTextCaptionBodyContent: (...args: any[]) => void; 23 | dragTextCaption: (...args: any[]) => void; 24 | // textCaption: Ref; 25 | } 26 | 27 | export interface IStickyNoteParams { 28 | // yArrayStickyNote: Ref>; 29 | stickyNoteHasEventSet: Set; 30 | changeStickyNoteBodyContent: (...args: any[]) => void; 31 | dragStickyNote: (...args: any[]) => void; 32 | // stickyNote: Ref; 33 | } 34 | 35 | export interface IMiniTextEditorParams { 36 | miniTextEditorHasEventSet: Set; 37 | changeMiniTextEditorBodyContent: (...args: any[]) => void; 38 | dragMiniTextEditor: (...args: any[]) => void; 39 | } 40 | 41 | export async function initYjs( 42 | stickyNoteParam: IStickyNoteParams, 43 | miniTextEditorParam: IMiniTextEditorParams, 44 | textCaptionParam: ITextCaptionParams, 45 | projectData:IProjectDetail 46 | 47 | ) { 48 | yDocStore.loading = true; 49 | yDocStore.doc.destroy() 50 | 51 | 52 | runFuncSequentially([ 53 | initCursor, 54 | initMouse, 55 | initDrawing, 56 | initMiniTextEditor(miniTextEditorParam), 57 | initStickyNote(stickyNoteParam), 58 | initTextCaption(textCaptionParam), 59 | ]) 60 | .then(() => { 61 | 62 | console.log('All func run....') 63 | // this allows you to instantly get the (cached) documents data 64 | // const indexeddbProvider = new IndexeddbPersistence( 65 | // `${projectData?.projectCode}`, 66 | // yDocStore.doc 67 | // ); 68 | 69 | // indexeddbProvider.whenSynced.then(() => { 70 | // yDocStore.loading = false; 71 | // console.log("loaded data from indexed db"); 72 | // }); 73 | }) 74 | .catch((err) => console.log(err)); 75 | 76 | const provider=new WebsocketProvider( 77 | "ws://localhost:1234", 78 | `sv000013-${projectData?.projectCode}`, 79 | yDocStore.doc 80 | ); 81 | 82 | 83 | //wait until the document is synchronized 84 | provider.on('sync',()=>{ 85 | yDocStore.loading = false; 86 | console.log('document is synchronized') 87 | }) 88 | 89 | 90 | 91 | 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. This will override any values set in the token's 45 | | "expires_at" attribute, but first-party sessions are not affected. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Token Prefix 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Sanctum can prefix new tokens in order to take advantage of numerous 57 | | security scanning initiatives maintained by open source platforms 58 | | that notify developers if they commit tokens into repositories. 59 | | 60 | | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning 61 | | 62 | */ 63 | 64 | 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Sanctum Middleware 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When authenticating your first-party SPA with Sanctum you may need to 72 | | customize some of the middleware Sanctum uses while processing the 73 | | request. You may change the middleware listed below as required. 74 | | 75 | */ 76 | 77 | 'middleware' => [ 78 | 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 79 | 'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, 80 | 'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, 81 | ], 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /app/Http/Controllers/Project/ProjectController.php: -------------------------------------------------------------------------------- 1 | get(); 22 | foreach($joinees as $row){ 23 | //event.. 24 | 25 | UserTypingEvent::dispatch($row->userId); 26 | 27 | } 28 | 29 | } 30 | 31 | 32 | public function getProjects(Request $request) 33 | { 34 | 35 | 36 | 37 | $data = Project::where('userId',$request->userId)->paginate(4); 38 | 39 | return response( $data, 200); 40 | } 41 | 42 | public function getProjectDetail(Request $request) 43 | { 44 | $projectCode=$request->project_code; 45 | $sendId=$request->sendId; 46 | 47 | $data = Project::where('projectCode', $projectCode)->first(); 48 | 49 | if(!is_null($data)){ 50 | ProjectBoardEvent::dispatch($projectCode); 51 | $this->knowWhoIsTyping($data->id,$sendId); 52 | 53 | 54 | return response( $data, 200); 55 | 56 | }else{ 57 | return response( [], 200); 58 | } 59 | 60 | } 61 | 62 | 63 | 64 | public function createProject(Request $request){ 65 | 66 | $fields=$request->all(); 67 | 68 | $errors = Validator::make($fields, [ 69 | 'name' => 'required', 70 | 'userId' => 'required', 71 | ]); 72 | 73 | if ($errors->fails()) { 74 | return response([ 75 | 'errors' => $errors->errors()->all(), 76 | 'message' => 'invalid input', 77 | ], 422); 78 | } 79 | 80 | 81 | 82 | $projectCode=Str::random(10).'-'.time(); 83 | $projectLink=url('/'); 84 | 85 | Project::create([ 86 | 'name' => $fields['name'], 87 | 'projectCode' => $projectCode, 88 | 'userId' => $fields['userId'], 89 | 'projectLink' => $projectLink, 90 | 91 | ]); 92 | 93 | return response(['message' => 'Project created successfully',200]); 94 | 95 | } 96 | 97 | 98 | public function updateProject(Request $request){ 99 | 100 | $fields=$request->all(); 101 | 102 | $errors = Validator::make($fields, [ 103 | 'id' => 'required', 104 | 'name' => 'required', 105 | 'userId' => 'required', 106 | ]); 107 | 108 | if ($errors->fails()) { 109 | return response([ 110 | 'errors' => $errors->errors()->all(), 111 | 'message' => 'invalid input', 112 | ], 422); 113 | } 114 | 115 | 116 | 117 | Project::where('id',$fields['id' ])->update([ 118 | 'name' => $fields['name'], 119 | ]); 120 | 121 | return response(['message' => 'Project updated successfully',200]); 122 | 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /config/reverb.php: -------------------------------------------------------------------------------- 1 | env('REVERB_SERVER', 'reverb'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Reverb Servers 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may define details for each of the supported Reverb servers. 24 | | Each server has its own configuration options that are defined in 25 | | the array below. You should ensure all the options are present. 26 | | 27 | */ 28 | 29 | 'servers' => [ 30 | 31 | 'reverb' => [ 32 | 'host' => env('REVERB_SERVER_HOST', '0.0.0.0'), 33 | 'port' => env('REVERB_SERVER_PORT', 8080), 34 | 'hostname' => env('REVERB_HOST'), 35 | 'options' => [ 36 | 'tls' => [], 37 | ], 38 | 'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000), 39 | 'scaling' => [ 40 | 'enabled' => env('REVERB_SCALING_ENABLED', false), 41 | 'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'), 42 | 'server' => [ 43 | 'url' => env('REDIS_URL'), 44 | 'host' => env('REDIS_HOST', '127.0.0.1'), 45 | 'port' => env('REDIS_PORT', '6379'), 46 | 'username' => env('REDIS_USERNAME'), 47 | 'password' => env('REDIS_PASSWORD'), 48 | 'database' => env('REDIS_DB', '0'), 49 | ], 50 | ], 51 | 'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15), 52 | 'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15), 53 | ], 54 | 55 | ], 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Reverb Applications 60 | |-------------------------------------------------------------------------- 61 | | 62 | | Here you may define how Reverb applications are managed. If you choose 63 | | to use the "config" provider, you may define an array of apps which 64 | | your server will support, including their connection credentials. 65 | | 66 | */ 67 | 68 | 'apps' => [ 69 | 70 | 'provider' => 'config', 71 | 72 | 'apps' => [ 73 | [ 74 | 'key' => env('REVERB_APP_KEY'), 75 | 'secret' => env('REVERB_APP_SECRET'), 76 | 'app_id' => env('REVERB_APP_ID'), 77 | 'options' => [ 78 | 'host' => env('REVERB_HOST'), 79 | 'port' => env('REVERB_PORT', 443), 80 | 'scheme' => env('REVERB_SCHEME', 'https'), 81 | 'useTLS' => env('REVERB_SCHEME', 'https') === 'https', 82 | ], 83 | 'allowed_origins' => ['*'], 84 | 'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60), 85 | 'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000), 86 | ], 87 | ], 88 | 89 | ], 90 | 91 | ]; 92 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_STORE', 'database'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "array", "database", "file", "memcached", 30 | | "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'array' => [ 37 | 'driver' => 'array', 38 | 'serialize' => false, 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => env('DB_CACHE_TABLE', 'cache'), 44 | 'connection' => env('DB_CACHE_CONNECTION'), 45 | 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), 46 | ], 47 | 48 | 'file' => [ 49 | 'driver' => 'file', 50 | 'path' => storage_path('framework/cache/data'), 51 | 'lock_path' => storage_path('framework/cache/data'), 52 | ], 53 | 54 | 'memcached' => [ 55 | 'driver' => 'memcached', 56 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 57 | 'sasl' => [ 58 | env('MEMCACHED_USERNAME'), 59 | env('MEMCACHED_PASSWORD'), 60 | ], 61 | 'options' => [ 62 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 63 | ], 64 | 'servers' => [ 65 | [ 66 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 67 | 'port' => env('MEMCACHED_PORT', 11211), 68 | 'weight' => 100, 69 | ], 70 | ], 71 | ], 72 | 73 | 'redis' => [ 74 | 'driver' => 'redis', 75 | 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), 76 | 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), 77 | ], 78 | 79 | 'dynamodb' => [ 80 | 'driver' => 'dynamodb', 81 | 'key' => env('AWS_ACCESS_KEY_ID'), 82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 85 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 86 | ], 87 | 88 | 'octane' => [ 89 | 'driver' => 'octane', 90 | ], 91 | 92 | ], 93 | 94 | /* 95 | |-------------------------------------------------------------------------- 96 | | Cache Key Prefix 97 | |-------------------------------------------------------------------------- 98 | | 99 | | When utilizing the APC, database, memcached, Redis, and DynamoDB cache 100 | | stores, there might be other applications using the same cache. For 101 | | that reason, you may prefix every cache key to avoid collisions. 102 | | 103 | */ 104 | 105 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 106 | 107 | ]; 108 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'log'), 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | Mailer Configurations 22 | |-------------------------------------------------------------------------- 23 | | 24 | | Here you may configure all of the mailers used by your application plus 25 | | their respective settings. Several examples have been configured for 26 | | you and you are free to add your own as your application requires. 27 | | 28 | | Laravel supports a variety of mail "transport" drivers that can be used 29 | | when delivering an email. You may specify which one you're using for 30 | | your mailers below. You may also add additional mailers if needed. 31 | | 32 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 33 | | "postmark", "resend", "log", "array", 34 | | "failover", "roundrobin" 35 | | 36 | */ 37 | 38 | 'mailers' => [ 39 | 40 | 'smtp' => [ 41 | 'transport' => 'smtp', 42 | 'url' => env('MAIL_URL'), 43 | 'host' => env('MAIL_HOST', '127.0.0.1'), 44 | 'port' => env('MAIL_PORT', 2525), 45 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 46 | 'username' => env('MAIL_USERNAME'), 47 | 'password' => env('MAIL_PASSWORD'), 48 | 'timeout' => null, 49 | 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)), 50 | ], 51 | 52 | 'ses' => [ 53 | 'transport' => 'ses', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | // 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), 59 | // 'client' => [ 60 | // 'timeout' => 5, 61 | // ], 62 | ], 63 | 64 | 'resend' => [ 65 | 'transport' => 'resend', 66 | ], 67 | 68 | 'sendmail' => [ 69 | 'transport' => 'sendmail', 70 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 71 | ], 72 | 73 | 'log' => [ 74 | 'transport' => 'log', 75 | 'channel' => env('MAIL_LOG_CHANNEL'), 76 | ], 77 | 78 | 'array' => [ 79 | 'transport' => 'array', 80 | ], 81 | 82 | 'failover' => [ 83 | 'transport' => 'failover', 84 | 'mailers' => [ 85 | 'smtp', 86 | 'log', 87 | ], 88 | ], 89 | 90 | 'roundrobin' => [ 91 | 'transport' => 'roundrobin', 92 | 'mailers' => [ 93 | 'ses', 94 | 'postmark', 95 | ], 96 | ], 97 | 98 | ], 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Global "From" Address 103 | |-------------------------------------------------------------------------- 104 | | 105 | | You may wish for all emails sent by your application to be sent from 106 | | the same address. Here you may specify a name and address that is 107 | | used globally for all emails that are sent by your application. 108 | | 109 | */ 110 | 111 | 'from' => [ 112 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 113 | 'name' => env('MAIL_FROM_NAME', 'Example'), 114 | ], 115 | 116 | ]; 117 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/http/getProjectDetail.ts: -------------------------------------------------------------------------------- 1 | import { RouteLocationNormalizedLoaded } from "vue-router"; 2 | import { makeHttpReq2 } from "../../../../../helper/makeHttpReq"; 3 | import { ref } from "vue"; 4 | import { userResponseType } from "../../../../auth/actions/tokenTypes"; 5 | import { showError } from "../../../../../helper/toastnotification"; 6 | import { yDocStore } from "../../../../../store/yDoc"; 7 | import { getUserData, LoginResponseType } from "../../../../../helper/auth"; 8 | 9 | export interface IProjectDetail { 10 | id: number; 11 | name: string; 12 | image: string; 13 | projectCode: string; 14 | userId: number; 15 | } 16 | export function useGetProjectDetail(route: RouteLocationNormalizedLoaded,userData:LoginResponseType| undefined) { 17 | const project_code = route?.query?.project_code; 18 | const loading = ref(false); 19 | const showJoinneesModal = ref(false); 20 | const sendId=userData?.user?.userId 21 | 22 | const projectData = ref({} as IProjectDetail); 23 | 24 | async function getProjectDetail() { 25 | try { 26 | loading.value = true; 27 | const data = await makeHttpReq2< 28 | undefined, 29 | IProjectDetail | Array 30 | >(`projects/detail?project_code=${project_code}&sendId=${sendId}`, "GET"); 31 | 32 | if (!Array.isArray(data)) { 33 | projectData.value = data; 34 | knowWhoIsTyping() 35 | } else { 36 | window.location.href = "/app/projects"; 37 | } 38 | 39 | loading.value = false; 40 | } catch (error) { 41 | showError((error as Error).message); 42 | loading.value = false; 43 | } 44 | } 45 | 46 | 47 | function knowWhoIsTyping() { 48 | 49 | 50 | window.Echo.private(`typing.${sendId}`) 51 | .listen("UserTypingEvent", (e: any) => { 52 | console.log("message here :", e); 53 | 54 | }) 55 | .listenForWhisper("typing", (e:any) => { 56 | yDocStore.cursor.typingUser=e.name 57 | console.log(e.name, " is typing..."); 58 | }).error((error: any) => { 59 | console.log(error); 60 | localStorage.clear(); 61 | window.location.href = "/app/login"; 62 | }); 63 | 64 | } 65 | 66 | 67 | function leavingUsers(joinee: userResponseType) { 68 | const filteredArray = yDocStore.joinees.filter( 69 | (user) => user.id !== joinee.id 70 | ); 71 | yDocStore.joinees = []; 72 | yDocStore.joinees = [...filteredArray]; 73 | } 74 | 75 | function joiningUsers(joinee: userResponseType) { 76 | const filteredArray = yDocStore.joinees.filter( 77 | (user) => user.id === joinee.id 78 | ); 79 | if (filteredArray.length === 0) { 80 | yDocStore.joinees.push(joinee); 81 | } 82 | } 83 | 84 | function showJoiningUsersModal() { 85 | showJoinneesModal.value = true; 86 | } 87 | function hideJoiningUsersModal() { 88 | showJoinneesModal.value = false; 89 | } 90 | 91 | 92 | 93 | function trackJoinAndLeavingUsers() { 94 | window.Echo.join(`project.room.${project_code}`) 95 | .here((users: userResponseType[]) => { 96 | yDocStore.joinees = [...users]; 97 | 98 | }) 99 | .joining((user: userResponseType) => { 100 | joiningUsers(user); 101 | }) 102 | .leaving((user: userResponseType) => { 103 | leavingUsers(user); 104 | }) 105 | .error((error: any) => { 106 | console.log(error); 107 | localStorage.clear(); 108 | window.location.href = "/app/login"; 109 | }); 110 | } 111 | 112 | return { 113 | getProjectDetail, 114 | projectData, 115 | showJoiningUsersModal, 116 | hideJoiningUsersModal, 117 | loading, 118 | showJoinneesModal, 119 | trackJoinAndLeavingUsers, 120 | 121 | }; 122 | } 123 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'database'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection options for every queue backend 24 | | used by your application. An example configuration is provided for 25 | | each backend supported by Laravel. You're also free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'connection' => env('DB_QUEUE_CONNECTION'), 40 | 'table' => env('DB_QUEUE_TABLE', 'jobs'), 41 | 'queue' => env('DB_QUEUE', 'default'), 42 | 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), 43 | 'after_commit' => false, 44 | ], 45 | 46 | 'beanstalkd' => [ 47 | 'driver' => 'beanstalkd', 48 | 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), 49 | 'queue' => env('BEANSTALKD_QUEUE', 'default'), 50 | 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), 51 | 'block_for' => 0, 52 | 'after_commit' => false, 53 | ], 54 | 55 | 'sqs' => [ 56 | 'driver' => 'sqs', 57 | 'key' => env('AWS_ACCESS_KEY_ID'), 58 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 59 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 60 | 'queue' => env('SQS_QUEUE', 'default'), 61 | 'suffix' => env('SQS_SUFFIX'), 62 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 63 | 'after_commit' => false, 64 | ], 65 | 66 | 'redis' => [ 67 | 'driver' => 'redis', 68 | 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), 69 | 'queue' => env('REDIS_QUEUE', 'default'), 70 | 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), 71 | 'block_for' => null, 72 | 'after_commit' => false, 73 | ], 74 | 75 | ], 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Job Batching 80 | |-------------------------------------------------------------------------- 81 | | 82 | | The following options configure the database and table that store job 83 | | batching information. These options can be updated to any database 84 | | connection and table which has been defined by your application. 85 | | 86 | */ 87 | 88 | 'batching' => [ 89 | 'database' => env('DB_CONNECTION', 'sqlite'), 90 | 'table' => 'job_batches', 91 | ], 92 | 93 | /* 94 | |-------------------------------------------------------------------------- 95 | | Failed Queue Jobs 96 | |-------------------------------------------------------------------------- 97 | | 98 | | These options configure the behavior of failed queue job logging so you 99 | | can control how and where failed jobs are stored. Laravel ships with 100 | | support for storing failed jobs in a simple file or in a database. 101 | | 102 | | Supported drivers: "database-uuids", "dynamodb", "file", "null" 103 | | 104 | */ 105 | 106 | 'failed' => [ 107 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 108 | 'database' => env('DB_CONNECTION', 'sqlite'), 109 | 'table' => 'failed_jobs', 110 | ], 111 | 112 | ]; 113 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => env('AUTH_GUARD', 'web'), 18 | 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | which utilizes session storage plus the Eloquent user provider. 29 | | 30 | | All authentication guards have a user provider, which defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | system used by the application. Typically, Eloquent is utilized. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 'api' => [ 44 | 'driver' => 'passport', 45 | 'provider' => 'users', 46 | ], 47 | ], 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | User Providers 52 | |-------------------------------------------------------------------------- 53 | | 54 | | All authentication guards have a user provider, which defines how the 55 | | users are actually retrieved out of your database or other storage 56 | | system used by the application. Typically, Eloquent is utilized. 57 | | 58 | | If you have multiple user tables or models you may configure multiple 59 | | providers to represent the model / table. These providers may then 60 | | be assigned to any extra authentication guards you have defined. 61 | | 62 | | Supported: "database", "eloquent" 63 | | 64 | */ 65 | 66 | 'providers' => [ 67 | 'users' => [ 68 | 'driver' => 'eloquent', 69 | 'model' => env('AUTH_MODEL', App\Models\User::class), 70 | ], 71 | 72 | // 'users' => [ 73 | // 'driver' => 'database', 74 | // 'table' => 'users', 75 | // ], 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Resetting Passwords 81 | |-------------------------------------------------------------------------- 82 | | 83 | | These configuration options specify the behavior of Laravel's password 84 | | reset functionality, including the table utilized for token storage 85 | | and the user provider that is invoked to actually retrieve users. 86 | | 87 | | The expiry time is the number of minutes that each reset token will be 88 | | considered valid. This security feature keeps tokens short-lived so 89 | | they have less time to be guessed. You may change this as needed. 90 | | 91 | | The throttle setting is the number of seconds a user must wait before 92 | | generating more password reset tokens. This prevents the user from 93 | | quickly generating a very large amount of password reset tokens. 94 | | 95 | */ 96 | 97 | 'passwords' => [ 98 | 'users' => [ 99 | 'provider' => 'users', 100 | 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), 101 | 'expire' => 60, 102 | 'throttle' => 60, 103 | ], 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Password Confirmation Timeout 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Here you may define the amount of seconds before a password confirmation 112 | | window expires and users are asked to re-enter their password via the 113 | | confirmation screen. By default, the timeout lasts for three hours. 114 | | 115 | */ 116 | 117 | 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), 118 | 119 | ]; 120 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application Environment 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This value determines the "environment" your application is currently 24 | | running in. This may determine how you prefer to configure various 25 | | services the application utilizes. Set this in your ".env" file. 26 | | 27 | */ 28 | 29 | 'env' => env('APP_ENV', 'production'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Debug Mode 34 | |-------------------------------------------------------------------------- 35 | | 36 | | When your application is in debug mode, detailed error messages with 37 | | stack traces will be shown on every error that occurs within your 38 | | application. If disabled, a simple generic error page is shown. 39 | | 40 | */ 41 | 42 | 'debug' => (bool) env('APP_DEBUG', false), 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application URL 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This URL is used by the console to properly generate URLs when using 50 | | the Artisan command line tool. You should set this to the root of 51 | | the application so that it's available within Artisan commands. 52 | | 53 | */ 54 | 55 | 'url' => env('APP_URL', 'http://localhost'), 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Application Timezone 60 | |-------------------------------------------------------------------------- 61 | | 62 | | Here you may specify the default timezone for your application, which 63 | | will be used by the PHP date and date-time functions. The timezone 64 | | is set to "UTC" by default as it is suitable for most use cases. 65 | | 66 | */ 67 | 68 | 'timezone' => env('APP_TIMEZONE', 'UTC'), 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Application Locale Configuration 73 | |-------------------------------------------------------------------------- 74 | | 75 | | The application locale determines the default locale that will be used 76 | | by Laravel's translation / localization methods. This option can be 77 | | set to any locale for which you plan to have translation strings. 78 | | 79 | */ 80 | 81 | 'locale' => env('APP_LOCALE', 'en'), 82 | 83 | 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), 84 | 85 | 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), 86 | 87 | /* 88 | |-------------------------------------------------------------------------- 89 | | Encryption Key 90 | |-------------------------------------------------------------------------- 91 | | 92 | | This key is utilized by Laravel's encryption services and should be set 93 | | to a random, 32 character string to ensure that all encrypted values 94 | | are secure. You should do this prior to deploying the application. 95 | | 96 | */ 97 | 98 | 'cipher' => 'AES-256-CBC', 99 | 100 | 'key' => env('APP_KEY'), 101 | 102 | 'previous_keys' => [ 103 | ...array_filter( 104 | explode(',', env('APP_PREVIOUS_KEYS', '')) 105 | ), 106 | ], 107 | 108 | /* 109 | |-------------------------------------------------------------------------- 110 | | Maintenance Mode Driver 111 | |-------------------------------------------------------------------------- 112 | | 113 | | These configuration options determine the driver used to determine and 114 | | manage Laravel's "maintenance mode" status. The "cache" driver will 115 | | allow maintenance mode to be controlled across multiple machines. 116 | | 117 | | Supported drivers: "file", "cache" 118 | | 119 | */ 120 | 121 | 'maintenance' => [ 122 | 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), 123 | 'store' => env('APP_MAINTENANCE_STORE', 'database'), 124 | ], 125 | 126 | ]; 127 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Deprecations Log Channel 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This option controls the log channel that should be used to log warnings 29 | | regarding deprecated PHP and library features. This allows you to get 30 | | your application ready for upcoming major versions of dependencies. 31 | | 32 | */ 33 | 34 | 'deprecations' => [ 35 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 36 | 'trace' => env('LOG_DEPRECATIONS_TRACE', false), 37 | ], 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Log Channels 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Here you may configure the log channels for your application. Laravel 45 | | utilizes the Monolog PHP logging library, which includes a variety 46 | | of powerful log handlers and formatters that you're free to use. 47 | | 48 | | Available Drivers: "single", "daily", "slack", "syslog", 49 | | "errorlog", "monolog", "custom", "stack" 50 | | 51 | */ 52 | 53 | 'channels' => [ 54 | 55 | 'stack' => [ 56 | 'driver' => 'stack', 57 | 'channels' => explode(',', env('LOG_STACK', 'single')), 58 | 'ignore_exceptions' => false, 59 | ], 60 | 61 | 'single' => [ 62 | 'driver' => 'single', 63 | 'path' => storage_path('logs/laravel.log'), 64 | 'level' => env('LOG_LEVEL', 'debug'), 65 | 'replace_placeholders' => true, 66 | ], 67 | 68 | 'daily' => [ 69 | 'driver' => 'daily', 70 | 'path' => storage_path('logs/laravel.log'), 71 | 'level' => env('LOG_LEVEL', 'debug'), 72 | 'days' => env('LOG_DAILY_DAYS', 14), 73 | 'replace_placeholders' => true, 74 | ], 75 | 76 | 'slack' => [ 77 | 'driver' => 'slack', 78 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 79 | 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), 80 | 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), 81 | 'level' => env('LOG_LEVEL', 'critical'), 82 | 'replace_placeholders' => true, 83 | ], 84 | 85 | 'papertrail' => [ 86 | 'driver' => 'monolog', 87 | 'level' => env('LOG_LEVEL', 'debug'), 88 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 89 | 'handler_with' => [ 90 | 'host' => env('PAPERTRAIL_URL'), 91 | 'port' => env('PAPERTRAIL_PORT'), 92 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 93 | ], 94 | 'processors' => [PsrLogMessageProcessor::class], 95 | ], 96 | 97 | 'stderr' => [ 98 | 'driver' => 'monolog', 99 | 'level' => env('LOG_LEVEL', 'debug'), 100 | 'handler' => StreamHandler::class, 101 | 'formatter' => env('LOG_STDERR_FORMATTER'), 102 | 'with' => [ 103 | 'stream' => 'php://stderr', 104 | ], 105 | 'processors' => [PsrLogMessageProcessor::class], 106 | ], 107 | 108 | 'syslog' => [ 109 | 'driver' => 'syslog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), 112 | 'replace_placeholders' => true, 113 | ], 114 | 115 | 'errorlog' => [ 116 | 'driver' => 'errorlog', 117 | 'level' => env('LOG_LEVEL', 'debug'), 118 | 'replace_placeholders' => true, 119 | ], 120 | 121 | 'null' => [ 122 | 'driver' => 'monolog', 123 | 'handler' => NullHandler::class, 124 | ], 125 | 126 | 'emergency' => [ 127 | 'path' => storage_path('logs/laravel.log'), 128 | ], 129 | 130 | ], 131 | 132 | ]; 133 | -------------------------------------------------------------------------------- /resources/js/src/pages/admin/ProjectPage.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 51 | 56 | 57 | 58 | 59 | 60 | 65 | 70 | 71 | 72 | 73 | 76 | 77 | 78 | 79 | Projects 80 | 81 | 85 | 86 | 87 | 88 | Logout 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 103 | 104 | 105 | 106 | Projects 107 | 108 | 109 | 110 | 111 | 112 | 116 | 117 | 118 | 119 | 120 | 121 | New Project 122 | 123 | 124 | 125 | 126 | 130 | 131 | 132 | 133 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 152 | -------------------------------------------------------------------------------- /resources/js/src/yjs/yjsUtil.ts: -------------------------------------------------------------------------------- 1 | import { useCanvas } from "../pages/admin/actions/project-board/canvas/canvas"; 2 | import { ITextCaption } from "../pages/admin/actions/project-board/text-caption/textCaptionTypes"; 3 | import { yDocStore } from "../store/yDoc"; 4 | import { IMiniTextEditorParams, IStickyNoteParams, ITextCaptionParams } from "./yjs"; 5 | 6 | const {initCanvas}=useCanvas() 7 | 8 | 9 | 10 | export const initTextCaption=(textCaptionParam: ITextCaptionParams) =>{ 11 | return function(){ 12 | return new Promise((resolve, reject) =>{ 13 | initYjsTypesForTextCaption(textCaptionParam); 14 | resolve(null) 15 | 16 | }) 17 | } 18 | } 19 | 20 | export const initStickyNote=(stickyNoteParam: IStickyNoteParams) =>{ 21 | return function(){ 22 | return new Promise((resolve, reject) =>{ 23 | initYjsTypesForStickyNote(stickyNoteParam); 24 | resolve(null) 25 | 26 | }) 27 | } 28 | } 29 | 30 | 31 | export const initMiniTextEditor=(miniTextEditorParam: IMiniTextEditorParams) =>{ 32 | return function(){ 33 | return new Promise((resolve, reject) =>{ 34 | initYjsTypesForMiniTextEditor(miniTextEditorParam); 35 | resolve(null) 36 | 37 | }) 38 | } 39 | } 40 | 41 | export const initCursor=() =>{ 42 | return new Promise((resolve, reject) =>{ 43 | initYjsTypesForCursor(); 44 | resolve(null) 45 | 46 | }) 47 | } 48 | 49 | 50 | export const initMouse=() =>{ 51 | return new Promise((resolve, reject) =>{ 52 | initYjsTypesForMouse(); 53 | resolve(null) 54 | 55 | }) 56 | } 57 | 58 | 59 | export const initDrawing=() =>{ 60 | return new Promise((resolve, reject) =>{ 61 | initYjsTypesDrawing() 62 | resolve(null) 63 | 64 | }) 65 | } 66 | 67 | 68 | function initYjsTypesForMiniTextEditor( 69 | miniTextEditorParam: IMiniTextEditorParams 70 | ) { 71 | const { 72 | miniTextEditorHasEventSet, 73 | changeMiniTextEditorBodyContent, 74 | dragMiniTextEditor, 75 | } = miniTextEditorParam; 76 | 77 | yDocStore.yArrayMiniTextEditor = yDocStore.doc.getArray( 78 | "y-array-mini-text-editor" 79 | ); 80 | 81 | yDocStore.yArrayMiniTextEditor.observe((event: any) => { 82 | yDocStore.miniTextEditor = yDocStore.yArrayMiniTextEditor.toArray(); 83 | 84 | for (const item of yDocStore.miniTextEditor) { 85 | 86 | // setTimeout(() => { 87 | // changeMiniTextEditorBodyContent(item.id); 88 | 89 | // }, 100); 90 | 91 | if (miniTextEditorHasEventSet.has(item.id) === false) { 92 | miniTextEditorHasEventSet.add(item.id); 93 | setTimeout(() => { 94 | dragMiniTextEditor(item.id); 95 | changeMiniTextEditorBodyContent(item.id); 96 | 97 | 98 | }, 100); 99 | } 100 | } 101 | }); 102 | } 103 | 104 | 105 | 106 | 107 | 108 | function initYjsTypesForTextCaption(textCaptionParam: ITextCaptionParams) { 109 | const { 110 | 111 | textCaptionHasEventSet, 112 | changeTextCaptionBodyContent, 113 | 114 | dragTextCaption, 115 | } = textCaptionParam; 116 | yDocStore.yArrayTextCaption = yDocStore.doc.getArray("y-array-text-caption"); 117 | 118 | yDocStore.yArrayTextCaption.observe((event: any) => { 119 | yDocStore.textCaption = yDocStore.yArrayTextCaption.toArray(); 120 | 121 | for (const item of yDocStore.textCaption) { 122 | setTimeout(() => changeTextCaptionBodyContent(item.id),1000) 123 | if (textCaptionHasEventSet.has(item.id) === false) { 124 | textCaptionHasEventSet.add(item.id); 125 | setTimeout(() => { 126 | dragTextCaption(item.id); 127 | 128 | 129 | 130 | }, 2000); 131 | } 132 | } 133 | }); 134 | } 135 | 136 | 137 | 138 | function initYjsTypesForStickyNote(stickyNoteParam: IStickyNoteParams) { 139 | const { 140 | 141 | stickyNoteHasEventSet, 142 | changeStickyNoteBodyContent, 143 | // stickyNote, 144 | dragStickyNote, 145 | } = stickyNoteParam; 146 | yDocStore.yArrayStickyNote = yDocStore.doc.getArray("y-array-sticky-notes"); 147 | 148 | yDocStore.yArrayStickyNote.observe((event: any) => { 149 | yDocStore.stickyNote = yDocStore.yArrayStickyNote.toArray(); 150 | 151 | for (const item of yDocStore.stickyNote) { 152 | 153 | setTimeout(() => changeStickyNoteBodyContent(item.id),1000) 154 | 155 | if (stickyNoteHasEventSet.has(item.id) === false) { 156 | stickyNoteHasEventSet.add(item.id); 157 | setTimeout(() => { 158 | dragStickyNote(item.id); 159 | 160 | 161 | 162 | }, 2000); 163 | } 164 | } 165 | }); 166 | } 167 | 168 | function initYjsTypesForMouse() { 169 | yDocStore.yMouse = yDocStore.doc.getMap("y-mouse"); 170 | 171 | yDocStore.yMouse.observe((event: any) => { 172 | yDocStore.mousePosition.x = yDocStore.yMouse.get("x") as number; 173 | yDocStore.mousePosition.y = yDocStore.yMouse.get("y") as number; 174 | yDocStore.mousePosition.userName = yDocStore.yMouse.get("userName") as string; 175 | 176 | 177 | 178 | }); 179 | } 180 | 181 | function initYjsTypesForCursor() { 182 | yDocStore.yCursor = yDocStore.doc.getMap("y-cursor"); 183 | 184 | yDocStore.yCursor.observe((event: any) => { 185 | yDocStore.cursor.x = yDocStore.yCursor.get("x") as string; 186 | yDocStore.cursor.y = yDocStore.yCursor.get("y") as string; 187 | yDocStore.cursor.typingUser = yDocStore.yCursor.get("typingUser") as string; 188 | 189 | 190 | }); 191 | } 192 | 193 | function initYjsTypesDrawing() { 194 | yDocStore.yArrayDrawing = yDocStore.doc.getArray("y-array-drawing"); 195 | yDocStore.yArrayDrawing.observe(async(event: any) => { 196 | yDocStore.arrayDrawing=yDocStore.yArrayDrawing.toArray(); 197 | 198 | 199 | (await initCanvas()).replayDrawing() 200 | 201 | }); 202 | } 203 | 204 | 205 | // const blinkingCursor = document.querySelector( 206 | // ".blinking-cursor-" + id 207 | // ) as HTMLElement; 208 | // blinkingCursor.style.display = "block"; -------------------------------------------------------------------------------- /resources/js/src/pages/admin/actions/project-board/http/getProjectBoardData.ts: -------------------------------------------------------------------------------- 1 | import { makeHttpReq2 } from "../../../../../helper/makeHttpReq"; 2 | import { ref } from "vue"; 3 | import { showError } from "../../../../../helper/toastnotification"; 4 | import { IReplayDrawing, yDocStore } from "../../../../../store/yDoc"; 5 | import { IStickyNote } from "../stickynote/stickyNoteTypes"; 6 | import { ITextCaption } from "../text-caption/textCaptionTypes"; 7 | import { IMiniTextEditor } from "../editor/miniTextEditorTypes"; 8 | import { getUserData, LoginResponseType } from "../../../../../helper/auth"; 9 | 10 | type DrawingType = { 11 | drawingData: string; 12 | } | null; 13 | type MiniTextEditorType = { 14 | miniTextEditorData: string; 15 | } | null; 16 | type StickyNoteType = { 17 | stickyNoteData: string; 18 | } | null; 19 | type TextCaptionType = { 20 | textCaptionData: string; 21 | } | null; 22 | export interface IProjectBoardData { 23 | miniTextEditor: MiniTextEditorType; 24 | stickyNote: StickyNoteType; 25 | textCaption: TextCaptionType; 26 | drawing: DrawingType; 27 | } 28 | 29 | export function useGetProjectBoardData( 30 | initCanvas: () => Promise<{ 31 | drawOnCanvas: () => void; 32 | undo: () => void; 33 | redo: () => void; 34 | replayDrawing: () => void; 35 | initCanvas: () => void; 36 | }>, 37 | dragStickyNote: (id: number) => void, 38 | changeStickyNoteBodyContent: (id: number) => void, 39 | dragTextCaption: (id: number) => void, 40 | changeTextCaptionBodyContent: (id: number) => void, 41 | dragMiniTextEditor: (id: number) => void, 42 | changeMiniTextEditorBodyContent: (id: number) => void, 43 | ) { 44 | const loading = ref(false); 45 | async function getProjectBoardData(projectId: number,userData:LoginResponseType|undefined) { 46 | const userId=userData?.user?.userId 47 | try { 48 | loading.value = true; 49 | const data = await makeHttpReq2( 50 | `project_boards?projectId=${projectId}&userId=${userId}`, 51 | "GET" 52 | ); 53 | 54 | await resetYDocArray() 55 | getDrawingData(data); 56 | getStickyNoteData(data); 57 | getTextCaptionData(data); 58 | getMiniTextEditorData(data) 59 | 60 | loading.value = false; 61 | 62 | 63 | } catch (error) { 64 | showError((error as Error).message); 65 | loading.value = false; 66 | } 67 | } 68 | 69 | async function getDrawingData(data: IProjectBoardData) { 70 | 71 | if (data.drawing !== null) { 72 | const drawingCoordinates: IReplayDrawing[][] = JSON.parse( 73 | data.drawing.drawingData 74 | ); 75 | yDocStore.arrayDrawing = [...drawingCoordinates]; 76 | yDocStore.yArrayDrawing.insert(0, drawingCoordinates); 77 | 78 | const canvas = await initCanvas(); 79 | canvas.replayDrawing(); 80 | } 81 | } 82 | 83 | 84 | function getMiniTextEditorData(data: IProjectBoardData) { 85 | if (data.miniTextEditor !== null) { 86 | const miniTextEditorData: IMiniTextEditor[] = JSON.parse( 87 | data.miniTextEditor.miniTextEditorData 88 | ); 89 | yDocStore.miniTextEditor = [...miniTextEditorData]; 90 | setTimeout(() => { 91 | yDocStore.yArrayMiniTextEditor.insert(0, [...miniTextEditorData]); 92 | 93 | miniTextEditorData.forEach((miniTextEditor) => { 94 | dragMiniTextEditor(miniTextEditor.id); 95 | changeMiniTextEditorBodyContent(miniTextEditor.id); 96 | }); 97 | }, 1000); 98 | } 99 | } 100 | 101 | 102 | function getStickyNoteData(data: IProjectBoardData) { 103 | if (data.stickyNote !== null) { 104 | const stickyNoteData: IStickyNote[] = JSON.parse( 105 | data.stickyNote.stickyNoteData 106 | ); 107 | yDocStore.stickyNote = [...stickyNoteData]; 108 | setTimeout(() => { 109 | yDocStore.yArrayStickyNote.insert(0, [...stickyNoteData]); 110 | 111 | stickyNoteData.forEach((stickyNote) => { 112 | dragStickyNote(stickyNote.id); 113 | changeStickyNoteBodyContent(stickyNote.id); 114 | }); 115 | }, 1000); 116 | } 117 | } 118 | 119 | function getTextCaptionData(data: IProjectBoardData) { 120 | if (data.textCaption !== null) { 121 | const textCaptionData: ITextCaption[] = JSON.parse( 122 | data.textCaption.textCaptionData 123 | ); 124 | 125 | yDocStore.textCaption = [...textCaptionData]; 126 | 127 | setTimeout(() => { 128 | yDocStore.yArrayTextCaption.insert(0, [...textCaptionData]); 129 | 130 | textCaptionData.forEach((textCaption) => { 131 | dragTextCaption(textCaption.id); 132 | changeTextCaptionBodyContent(textCaption.id); 133 | }); 134 | }, 1000); 135 | } 136 | } 137 | 138 | /** 139 | * 140 | * reset drawing, stickyNote, textCaption and miniTextEditor array 141 | */ 142 | function resetYDocArray() { 143 | return new Promise((resolve, reject) => { 144 | setTimeout(() => { 145 | 146 | const drawingArray = yDocStore.yArrayDrawing.toArray(); 147 | yDocStore.yArrayDrawing.delete(0, drawingArray.length); 148 | 149 | const textCaptionArray = yDocStore.yArrayTextCaption.toArray(); 150 | yDocStore.yArrayTextCaption.delete(0, textCaptionArray.length); 151 | yDocStore.textCaption = []; 152 | 153 | const stickyNoteArray = yDocStore.yArrayStickyNote.toArray(); 154 | yDocStore.yArrayStickyNote.delete(0, stickyNoteArray.length); 155 | yDocStore.stickyNote = []; 156 | 157 | const miniTextEditorArray = yDocStore.yArrayMiniTextEditor.toArray(); 158 | yDocStore.yArrayMiniTextEditor.delete(0, miniTextEditorArray.length); 159 | yDocStore.miniTextEditor = []; 160 | 161 | 162 | resolve(null); 163 | 164 | 165 | }, 1000); 166 | }); 167 | } 168 | 169 | 170 | 171 | return { getProjectBoardData, loading }; 172 | } 173 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'sqlite'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Database Connections 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Below are all of the database connections defined for your application. 27 | | An example configuration is provided for each database system which 28 | | is supported by Laravel. You're free to add / remove connections. 29 | | 30 | */ 31 | 32 | 'connections' => [ 33 | 34 | 'sqlite' => [ 35 | 'driver' => 'sqlite', 36 | 'url' => env('DB_URL'), 37 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 38 | 'prefix' => '', 39 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 40 | ], 41 | 42 | 'mysql' => [ 43 | 'driver' => 'mysql', 44 | 'url' => env('DB_URL'), 45 | 'host' => env('DB_HOST', '127.0.0.1'), 46 | 'port' => env('DB_PORT', '3306'), 47 | 'database' => env('DB_DATABASE', 'laravel'), 48 | 'username' => env('DB_USERNAME', 'root'), 49 | 'password' => env('DB_PASSWORD', ''), 50 | 'unix_socket' => env('DB_SOCKET', ''), 51 | 'charset' => env('DB_CHARSET', 'utf8mb4'), 52 | 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 53 | 'prefix' => '', 54 | 'prefix_indexes' => true, 55 | 'strict' => true, 56 | 'engine' => null, 57 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 58 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 59 | ]) : [], 60 | ], 61 | 62 | 'mariadb' => [ 63 | 'driver' => 'mariadb', 64 | 'url' => env('DB_URL'), 65 | 'host' => env('DB_HOST', '127.0.0.1'), 66 | 'port' => env('DB_PORT', '3306'), 67 | 'database' => env('DB_DATABASE', 'laravel'), 68 | 'username' => env('DB_USERNAME', 'root'), 69 | 'password' => env('DB_PASSWORD', ''), 70 | 'unix_socket' => env('DB_SOCKET', ''), 71 | 'charset' => env('DB_CHARSET', 'utf8mb4'), 72 | 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 73 | 'prefix' => '', 74 | 'prefix_indexes' => true, 75 | 'strict' => true, 76 | 'engine' => null, 77 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 78 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 79 | ]) : [], 80 | ], 81 | 82 | 'pgsql' => [ 83 | 'driver' => 'pgsql', 84 | 'url' => env('DB_URL'), 85 | 'host' => env('DB_HOST', '127.0.0.1'), 86 | 'port' => env('DB_PORT', '5432'), 87 | 'database' => env('DB_DATABASE', 'laravel'), 88 | 'username' => env('DB_USERNAME', 'root'), 89 | 'password' => env('DB_PASSWORD', ''), 90 | 'charset' => env('DB_CHARSET', 'utf8'), 91 | 'prefix' => '', 92 | 'prefix_indexes' => true, 93 | 'search_path' => 'public', 94 | 'sslmode' => 'prefer', 95 | ], 96 | 97 | 'sqlsrv' => [ 98 | 'driver' => 'sqlsrv', 99 | 'url' => env('DB_URL'), 100 | 'host' => env('DB_HOST', 'localhost'), 101 | 'port' => env('DB_PORT', '1433'), 102 | 'database' => env('DB_DATABASE', 'laravel'), 103 | 'username' => env('DB_USERNAME', 'root'), 104 | 'password' => env('DB_PASSWORD', ''), 105 | 'charset' => env('DB_CHARSET', 'utf8'), 106 | 'prefix' => '', 107 | 'prefix_indexes' => true, 108 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 109 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 110 | ], 111 | 112 | ], 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Migration Repository Table 117 | |-------------------------------------------------------------------------- 118 | | 119 | | This table keeps track of all the migrations that have already run for 120 | | your application. Using this information, we can determine which of 121 | | the migrations on disk haven't actually been run on the database. 122 | | 123 | */ 124 | 125 | 'migrations' => [ 126 | 'table' => 'migrations', 127 | 'update_date_on_publish' => true, 128 | ], 129 | 130 | /* 131 | |-------------------------------------------------------------------------- 132 | | Redis Databases 133 | |-------------------------------------------------------------------------- 134 | | 135 | | Redis is an open source, fast, and advanced key-value store that also 136 | | provides a richer body of commands than a typical key-value system 137 | | such as Memcached. You may define your connection settings here. 138 | | 139 | */ 140 | 141 | 'redis' => [ 142 | 143 | 'client' => env('REDIS_CLIENT', 'phpredis'), 144 | 145 | 'options' => [ 146 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 147 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 148 | ], 149 | 150 | 'default' => [ 151 | 'url' => env('REDIS_URL'), 152 | 'host' => env('REDIS_HOST', '127.0.0.1'), 153 | 'username' => env('REDIS_USERNAME'), 154 | 'password' => env('REDIS_PASSWORD'), 155 | 'port' => env('REDIS_PORT', '6379'), 156 | 'database' => env('REDIS_DB', '0'), 157 | ], 158 | 159 | 'cache' => [ 160 | 'url' => env('REDIS_URL'), 161 | 'host' => env('REDIS_HOST', '127.0.0.1'), 162 | 'username' => env('REDIS_USERNAME'), 163 | 'password' => env('REDIS_PASSWORD'), 164 | 'port' => env('REDIS_PORT', '6379'), 165 | 'database' => env('REDIS_CACHE_DB', '1'), 166 | ], 167 | 168 | ], 169 | 170 | ]; 171 | --------------------------------------------------------------------------------
{{ project.name }}