@stone-js/starters 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/basic-react-declarative/LICENSE +21 -0
- package/basic-react-declarative/README.md +39 -0
- package/basic-react-declarative/app/Application.tsx +89 -0
- package/basic-react-declarative/assets/css/index.css +26 -0
- package/basic-react-declarative/package.json +39 -0
- package/basic-react-declarative/public/logo.png +0 -0
- package/basic-react-declarative/tests/Application.spec.ts +96 -0
- package/basic-react-declarative/tests/__snapshots__/Application.spec.ts.snap +3 -0
- package/basic-react-declarative/tsconfig.json +33 -0
- package/basic-react-declarative/vitest.config.ts +24 -0
- package/basic-react-imperative/LICENSE +21 -0
- package/basic-react-imperative/README.md +39 -0
- package/basic-react-imperative/app/Application.tsx +89 -0
- package/basic-react-imperative/assets/css/index.css +26 -0
- package/basic-react-imperative/package.json +39 -0
- package/basic-react-imperative/public/logo.png +0 -0
- package/basic-react-imperative/tests/Application.spec.ts +80 -0
- package/basic-react-imperative/tests/__snapshots__/Application.spec.ts.snap +3 -0
- package/basic-react-imperative/tsconfig.json +33 -0
- package/basic-react-imperative/vitest.config.ts +24 -0
- package/basic-service-declarative/LICENSE +21 -0
- package/basic-service-declarative/README.md +39 -0
- package/basic-service-declarative/app/Application.ts +56 -0
- package/basic-service-declarative/package.json +34 -0
- package/basic-service-declarative/tests/Application.spec.ts +60 -0
- package/basic-service-declarative/tsconfig.json +25 -0
- package/basic-service-declarative/vitest.config.ts +24 -0
- package/basic-service-imperative/LICENSE +21 -0
- package/basic-service-imperative/README.md +39 -0
- package/basic-service-imperative/app/Application.ts +60 -0
- package/basic-service-imperative/package.json +34 -0
- package/basic-service-imperative/tests/Application.spec.ts +52 -0
- package/basic-service-imperative/tsconfig.json +25 -0
- package/basic-service-imperative/vitest.config.ts +24 -0
- package/continuum-showcase/README.md +44 -0
- package/continuum-showcase/app/env.d.ts +34 -0
- package/continuum-showcase/app/layouts/MainLayout.tsx +20 -0
- package/continuum-showcase/app/pages/BlogPostPage.tsx +62 -0
- package/continuum-showcase/app/pages/HomePage.tsx +58 -0
- package/continuum-showcase/package.json +25 -0
- package/continuum-showcase/stone.config.mjs +20 -0
- package/full-react-declarative/.env.example +1 -0
- package/full-react-declarative/.env.public.example +1 -0
- package/full-react-declarative/LICENSE +21 -0
- package/full-react-declarative/README.md +39 -0
- package/full-react-declarative/app/Application.ts +85 -0
- package/full-react-declarative/app/clients/AxiosClient.ts +136 -0
- package/full-react-declarative/app/clients/CommentClient.ts +61 -0
- package/full-react-declarative/app/clients/PostClient.ts +90 -0
- package/full-react-declarative/app/clients/SecurityClient.ts +66 -0
- package/full-react-declarative/app/clients/UserClient.ts +97 -0
- package/full-react-declarative/app/components/ChangePasswordForm/ChangePasswordForm.tsx +50 -0
- package/full-react-declarative/app/components/CommentForm/CommentForm.tsx +37 -0
- package/full-react-declarative/app/components/CommentItem/CommentItem.tsx +42 -0
- package/full-react-declarative/app/components/CommentWidget/CommentWidget.tsx +95 -0
- package/full-react-declarative/app/components/LoginForm/LoginForm.css +0 -0
- package/full-react-declarative/app/components/LoginForm/LoginForm.tsx +71 -0
- package/full-react-declarative/app/components/PostDetails/PostDetails.tsx +44 -0
- package/full-react-declarative/app/components/PostForm/PostForm.css +0 -0
- package/full-react-declarative/app/components/PostForm/PostForm.tsx +47 -0
- package/full-react-declarative/app/components/PostItem/PostItem.css +0 -0
- package/full-react-declarative/app/components/PostItem/PostItem.tsx +34 -0
- package/full-react-declarative/app/components/RegisterForm/RegisterForm.tsx +110 -0
- package/full-react-declarative/app/components/UserForm/UserForm.tsx +47 -0
- package/full-react-declarative/app/configurations/AppConfiguration.ts +17 -0
- package/full-react-declarative/app/error-pages/DefaultErrorPage/DefaultErrorPage.css +0 -0
- package/full-react-declarative/app/error-pages/DefaultErrorPage/DefaultErrorPage.tsx +52 -0
- package/full-react-declarative/app/error-pages/ForbiddenErrorPage/ForbiddenErrorPage.css +0 -0
- package/full-react-declarative/app/error-pages/ForbiddenErrorPage/ForbiddenErrorPage.tsx +53 -0
- package/full-react-declarative/app/error-pages/NotFoundErrorPage/NotFoundErrorPage.css +0 -0
- package/full-react-declarative/app/error-pages/NotFoundErrorPage/NotFoundErrorPage.tsx +54 -0
- package/full-react-declarative/app/error-pages/UnauthorizedErrorPage/UnauthorizedErrorPage.css +0 -0
- package/full-react-declarative/app/error-pages/UnauthorizedErrorPage/UnauthorizedErrorPage.tsx +53 -0
- package/full-react-declarative/app/errors/ForbiddenError.ts +11 -0
- package/full-react-declarative/app/errors/PostNotFoundError.ts +11 -0
- package/full-react-declarative/app/errors/UnauthorizedError.ts +11 -0
- package/full-react-declarative/app/errors/UserNotFoundError.ts +11 -0
- package/full-react-declarative/app/events/UserEvent.ts +18 -0
- package/full-react-declarative/app/layout/AppLayout/AppLayout.css +20 -0
- package/full-react-declarative/app/layout/AppLayout/AppLayout.tsx +101 -0
- package/full-react-declarative/app/layout/ErrorLayout/ErrorLayout.css +0 -0
- package/full-react-declarative/app/layout/ErrorLayout/ErrorLayout.tsx +41 -0
- package/full-react-declarative/app/layout/SecurityLayout/SecurityLayout.css +0 -0
- package/full-react-declarative/app/layout/SecurityLayout/SecurityLayout.tsx +39 -0
- package/full-react-declarative/app/middleware/AuthMiddleware.ts +85 -0
- package/full-react-declarative/app/models/Comment.ts +31 -0
- package/full-react-declarative/app/models/Post.ts +22 -0
- package/full-react-declarative/app/models/User.ts +62 -0
- package/full-react-declarative/app/pages/home/HomePage.tsx +44 -0
- package/full-react-declarative/app/pages/login/LoginPage.css +0 -0
- package/full-react-declarative/app/pages/login/LoginPage.tsx +73 -0
- package/full-react-declarative/app/pages/posts/CreatePostPage/CreatePostPage.css +0 -0
- package/full-react-declarative/app/pages/posts/CreatePostPage/CreatePostPage.tsx +67 -0
- package/full-react-declarative/app/pages/posts/PostPage/PostPage.tsx +60 -0
- package/full-react-declarative/app/pages/posts/ShowPostPage/ShowPostPage.tsx +83 -0
- package/full-react-declarative/app/pages/posts/UpdatePostPage/UpdatePostPage.tsx +77 -0
- package/full-react-declarative/app/pages/register/RegisterPage.tsx +68 -0
- package/full-react-declarative/app/pages/users/CreateUserPage.tsx +48 -0
- package/full-react-declarative/app/pages/users/ShowUserPage.tsx +62 -0
- package/full-react-declarative/app/pages/users/UpdateUserPage.tsx +57 -0
- package/full-react-declarative/app/pages/users/UserPage.tsx +57 -0
- package/full-react-declarative/app/providers/AppServiceProvider.ts +43 -0
- package/full-react-declarative/app/services/CommentService.ts +59 -0
- package/full-react-declarative/app/services/PostService.ts +108 -0
- package/full-react-declarative/app/services/SecurityService.ts +80 -0
- package/full-react-declarative/app/services/TokenService.ts +116 -0
- package/full-react-declarative/app/services/UserService.ts +126 -0
- package/full-react-declarative/app/utils.ts +17 -0
- package/full-react-declarative/assets/css/index.css +301 -0
- package/full-react-declarative/assets/img/logo.png +0 -0
- package/full-react-declarative/package.json +46 -0
- package/full-react-declarative/public/logo.png +0 -0
- package/full-react-declarative/public/vite.svg +1 -0
- package/full-react-declarative/stone.config.mjs +12 -0
- package/full-react-declarative/tsconfig.json +29 -0
- package/full-react-declarative/vitest.config.ts +24 -0
- package/full-react-imperative/.env.example +1 -0
- package/full-react-imperative/.env.public.example +1 -0
- package/full-react-imperative/LICENSE +21 -0
- package/full-react-imperative/README.md +39 -0
- package/full-react-imperative/app/Application.ts +79 -0
- package/full-react-imperative/app/clients/AxiosClient.ts +124 -0
- package/full-react-imperative/app/clients/CommentClient.ts +57 -0
- package/full-react-imperative/app/clients/PostClient.ts +86 -0
- package/full-react-imperative/app/clients/SecurityClient.ts +60 -0
- package/full-react-imperative/app/clients/UserClient.ts +93 -0
- package/full-react-imperative/app/clients/contracts/IAxiosClient.ts +97 -0
- package/full-react-imperative/app/clients/contracts/ICommentClient.ts +31 -0
- package/full-react-imperative/app/clients/contracts/IPostClient.ts +55 -0
- package/full-react-imperative/app/clients/contracts/ISecurityClient.ts +33 -0
- package/full-react-imperative/app/clients/contracts/IUserClient.ts +61 -0
- package/full-react-imperative/app/components/ChangePasswordForm/ChangePasswordForm.tsx +50 -0
- package/full-react-imperative/app/components/CommentForm/CommentForm.css +35 -0
- package/full-react-imperative/app/components/CommentForm/CommentForm.tsx +45 -0
- package/full-react-imperative/app/components/CommentItem/CommentItem.css +74 -0
- package/full-react-imperative/app/components/CommentItem/CommentItem.tsx +62 -0
- package/full-react-imperative/app/components/CommentWidget/CommentWidget.css +25 -0
- package/full-react-imperative/app/components/CommentWidget/CommentWidget.tsx +119 -0
- package/full-react-imperative/app/components/Dropdown/Dropdown.css +52 -0
- package/full-react-imperative/app/components/Dropdown/Dropdown.tsx +40 -0
- package/full-react-imperative/app/components/LayoutHeader/LayoutHeader.css +62 -0
- package/full-react-imperative/app/components/LayoutHeader/LayoutHeader.tsx +61 -0
- package/full-react-imperative/app/components/LayoutLeftMenu/LayoutLeftMenu.css +25 -0
- package/full-react-imperative/app/components/LayoutLeftMenu/LayoutLeftMenu.tsx +32 -0
- package/full-react-imperative/app/components/LoginForm/LoginForm.css +0 -0
- package/full-react-imperative/app/components/LoginForm/LoginForm.tsx +71 -0
- package/full-react-imperative/app/components/NotificationBadge/NotificationBadge.css +41 -0
- package/full-react-imperative/app/components/NotificationBadge/NotificationBadge.tsx +63 -0
- package/full-react-imperative/app/components/PostCard/PostCard.css +129 -0
- package/full-react-imperative/app/components/PostCard/PostCard.tsx +65 -0
- package/full-react-imperative/app/components/PostForm/PostForm.css +92 -0
- package/full-react-imperative/app/components/PostForm/PostForm.tsx +76 -0
- package/full-react-imperative/app/components/PostSkeleton/PostSkeleton.css +65 -0
- package/full-react-imperative/app/components/PostSkeleton/PostSkeleton.tsx +25 -0
- package/full-react-imperative/app/components/PostWidget/PostWidget.tsx +95 -0
- package/full-react-imperative/app/components/ProfileForm/ProfileForm.css +84 -0
- package/full-react-imperative/app/components/ProfileForm/ProfileForm.tsx +79 -0
- package/full-react-imperative/app/components/RegisterForm/RegisterForm.tsx +110 -0
- package/full-react-imperative/app/components/RightAsidePanel/RightAsidePanel.css +32 -0
- package/full-react-imperative/app/components/RightAsidePanel/RightAsidePanel.tsx +62 -0
- package/full-react-imperative/app/components/SettingsForm/SettingsForm.css +126 -0
- package/full-react-imperative/app/components/SettingsForm/SettingsForm.tsx +86 -0
- package/full-react-imperative/app/components/UserAvatar/UserAvatar.css +18 -0
- package/full-react-imperative/app/components/UserAvatar/UserAvatar.tsx +60 -0
- package/full-react-imperative/app/components/UserBadge/UserBadge.css +33 -0
- package/full-react-imperative/app/components/UserBadge/UserBadge.tsx +49 -0
- package/full-react-imperative/app/components/UserCard/UserCard.css +70 -0
- package/full-react-imperative/app/components/UserCard/UserCard.tsx +43 -0
- package/full-react-imperative/app/configurations/AppConfiguration.ts +19 -0
- package/full-react-imperative/app/error-pages/DefaultErrorPage/DefaultErrorPage.css +0 -0
- package/full-react-imperative/app/error-pages/DefaultErrorPage/DefaultErrorPage.tsx +41 -0
- package/full-react-imperative/app/error-pages/ForbiddenErrorPage/ForbiddenErrorPage.css +0 -0
- package/full-react-imperative/app/error-pages/ForbiddenErrorPage/ForbiddenErrorPage.tsx +42 -0
- package/full-react-imperative/app/error-pages/NotFoundErrorPage/NotFoundErrorPage.css +0 -0
- package/full-react-imperative/app/error-pages/NotFoundErrorPage/NotFoundErrorPage.tsx +49 -0
- package/full-react-imperative/app/error-pages/UnauthorizedErrorPage/UnauthorizedErrorPage.css +0 -0
- package/full-react-imperative/app/error-pages/UnauthorizedErrorPage/UnauthorizedErrorPage.tsx +42 -0
- package/full-react-imperative/app/errors/ForbiddenError.ts +11 -0
- package/full-react-imperative/app/errors/PostNotFoundError.ts +11 -0
- package/full-react-imperative/app/errors/UnauthorizedError.ts +11 -0
- package/full-react-imperative/app/errors/UserNotFoundError.ts +11 -0
- package/full-react-imperative/app/events/UserEvent.ts +18 -0
- package/full-react-imperative/app/layout/AppLayout/AppLayout.css +106 -0
- package/full-react-imperative/app/layout/AppLayout/AppLayout.tsx +48 -0
- package/full-react-imperative/app/layout/ErrorLayout/ErrorLayout.css +0 -0
- package/full-react-imperative/app/layout/ErrorLayout/ErrorLayout.tsx +45 -0
- package/full-react-imperative/app/layout/SecurityLayout/SecurityLayout.css +0 -0
- package/full-react-imperative/app/layout/SecurityLayout/SecurityLayout.tsx +43 -0
- package/full-react-imperative/app/layout/SettingsLayout/SettingsLayout.css +99 -0
- package/full-react-imperative/app/layout/SettingsLayout/SettingsLayout.tsx +44 -0
- package/full-react-imperative/app/middleware/AuthMiddleware.ts +56 -0
- package/full-react-imperative/app/models/Comment.ts +35 -0
- package/full-react-imperative/app/models/Post.ts +27 -0
- package/full-react-imperative/app/models/User.ts +68 -0
- package/full-react-imperative/app/pages/Settings/SettingsPage.tsx +23 -0
- package/full-react-imperative/app/pages/home/HomePage.tsx +58 -0
- package/full-react-imperative/app/pages/login/LoginPage.css +0 -0
- package/full-react-imperative/app/pages/login/LoginPage.tsx +65 -0
- package/full-react-imperative/app/pages/posts/ShowPostPage/ShowPostPage.tsx +64 -0
- package/full-react-imperative/app/pages/posts/UpdatePostPage/UpdatePostPage.tsx +56 -0
- package/full-react-imperative/app/pages/register/RegisterPage.tsx +71 -0
- package/full-react-imperative/app/pages/users/ShowUserPage/ShowUserPage.css +64 -0
- package/full-react-imperative/app/pages/users/ShowUserPage/ShowUserPage.tsx +104 -0
- package/full-react-imperative/app/pages/users/UpdateUserPage/UpdateUserPage.css +0 -0
- package/full-react-imperative/app/pages/users/UpdateUserPage/UpdateUserPage.tsx +43 -0
- package/full-react-imperative/app/pages/users/UserPage/UserPage.css +31 -0
- package/full-react-imperative/app/pages/users/UserPage/UserPage.tsx +59 -0
- package/full-react-imperative/app/pages/utils.ts +67 -0
- package/full-react-imperative/app/providers/AppServiceProvider.ts +40 -0
- package/full-react-imperative/app/services/CommentService.ts +53 -0
- package/full-react-imperative/app/services/PostService.ts +102 -0
- package/full-react-imperative/app/services/SecurityService.ts +72 -0
- package/full-react-imperative/app/services/TokenService.ts +108 -0
- package/full-react-imperative/app/services/UserService.ts +115 -0
- package/full-react-imperative/app/services/contracts/ICommentService.ts +30 -0
- package/full-react-imperative/app/services/contracts/IPostService.ts +65 -0
- package/full-react-imperative/app/services/contracts/ISecurityService.ts +39 -0
- package/full-react-imperative/app/services/contracts/ITokenService.ts +44 -0
- package/full-react-imperative/app/services/contracts/IUserService.ts +70 -0
- package/full-react-imperative/app/utils.ts +31 -0
- package/full-react-imperative/assets/css/index.css +301 -0
- package/full-react-imperative/assets/img/logo.png +0 -0
- package/full-react-imperative/package.json +48 -0
- package/full-react-imperative/public/logo.png +0 -0
- package/full-react-imperative/public/vite.svg +1 -0
- package/full-react-imperative/stone.config.mjs +12 -0
- package/full-react-imperative/tsconfig.json +29 -0
- package/full-react-imperative/vitest.config.ts +24 -0
- package/full-service-declarative/.env.example +2 -0
- package/full-service-declarative/LICENSE +21 -0
- package/full-service-declarative/README.md +65 -0
- package/full-service-declarative/app/Application.ts +327 -0
- package/full-service-declarative/app/commands/ListSessionsCommand.ts +70 -0
- package/full-service-declarative/app/commands/ListUsersCommand.ts +56 -0
- package/full-service-declarative/app/configurations/AppConfiguration.ts +52 -0
- package/full-service-declarative/app/configurations/UserLiveConfiguration.ts +28 -0
- package/full-service-declarative/app/database/DatabaseClient.ts +43 -0
- package/full-service-declarative/app/database/schema.ts +43 -0
- package/full-service-declarative/app/error-handlers/SecurityErrorHandler.ts +61 -0
- package/full-service-declarative/app/errors/CredentialsError.ts +12 -0
- package/full-service-declarative/app/events/UserEvent.ts +17 -0
- package/full-service-declarative/app/handlers/CommentEventHandler.ts +103 -0
- package/full-service-declarative/app/handlers/PostEventHandler.ts +104 -0
- package/full-service-declarative/app/handlers/SecurityEventHandler.ts +108 -0
- package/full-service-declarative/app/handlers/UserEventHandler.ts +159 -0
- package/full-service-declarative/app/listeners/UserEventListener.ts +35 -0
- package/full-service-declarative/app/middleware/AuthMiddleware.ts +54 -0
- package/full-service-declarative/app/models/Comment.ts +38 -0
- package/full-service-declarative/app/models/Post.ts +50 -0
- package/full-service-declarative/app/models/Session.ts +14 -0
- package/full-service-declarative/app/models/User.ts +77 -0
- package/full-service-declarative/app/providers/DrizzleServiceProvider.ts +59 -0
- package/full-service-declarative/app/repositories/CommentRepository.ts +155 -0
- package/full-service-declarative/app/repositories/PostRepository.ts +138 -0
- package/full-service-declarative/app/repositories/SessionRepository.ts +123 -0
- package/full-service-declarative/app/repositories/UserRepository.ts +99 -0
- package/full-service-declarative/app/services/CommentService.ts +112 -0
- package/full-service-declarative/app/services/PostService.ts +100 -0
- package/full-service-declarative/app/services/SecurityService.ts +232 -0
- package/full-service-declarative/app/services/SessionService.ts +130 -0
- package/full-service-declarative/app/services/UserService.ts +110 -0
- package/full-service-declarative/app/subscribers/UserEventSubscriber.ts +38 -0
- package/full-service-declarative/drizzle.config.ts +13 -0
- package/full-service-declarative/package.json +48 -0
- package/full-service-declarative/stone.config.mjs +12 -0
- package/full-service-declarative/tsconfig.json +25 -0
- package/full-service-declarative/vitest.config.ts +24 -0
- package/full-service-imperative/.env.example +2 -0
- package/full-service-imperative/LICENSE +21 -0
- package/full-service-imperative/README.md +65 -0
- package/full-service-imperative/app/Application.ts +317 -0
- package/full-service-imperative/app/commands/ListSessionsCommand.ts +54 -0
- package/full-service-imperative/app/commands/ListUsersCommand.ts +42 -0
- package/full-service-imperative/app/configurations/AppConfiguration.ts +44 -0
- package/full-service-imperative/app/configurations/UserLiveConfiguration.ts +26 -0
- package/full-service-imperative/app/database/DatabaseClient.ts +39 -0
- package/full-service-imperative/app/database/schema.ts +43 -0
- package/full-service-imperative/app/error-handlers/SecurityErrorHandler.ts +58 -0
- package/full-service-imperative/app/errors/CredentialsError.ts +12 -0
- package/full-service-imperative/app/events/UserEvent.ts +17 -0
- package/full-service-imperative/app/handlers/CommentEventHandler.ts +99 -0
- package/full-service-imperative/app/handlers/PostEventHandler.ts +99 -0
- package/full-service-imperative/app/handlers/SecurityEventHandler.ts +83 -0
- package/full-service-imperative/app/handlers/UserEventHandler.ts +132 -0
- package/full-service-imperative/app/listeners/UserEventListener.ts +23 -0
- package/full-service-imperative/app/middleware/AuthMiddleware.ts +44 -0
- package/full-service-imperative/app/models/Comment.ts +38 -0
- package/full-service-imperative/app/models/Post.ts +50 -0
- package/full-service-imperative/app/models/Session.ts +14 -0
- package/full-service-imperative/app/models/User.ts +77 -0
- package/full-service-imperative/app/providers/DrizzleServiceProvider.ts +56 -0
- package/full-service-imperative/app/repositories/CommentRepository.ts +148 -0
- package/full-service-imperative/app/repositories/PostRepository.ts +130 -0
- package/full-service-imperative/app/repositories/SessionRepository.ts +115 -0
- package/full-service-imperative/app/repositories/UserRepository.ts +91 -0
- package/full-service-imperative/app/repositories/contracts/ICommentRepository.ts +72 -0
- package/full-service-imperative/app/repositories/contracts/IPostRepository.ts +63 -0
- package/full-service-imperative/app/repositories/contracts/ISessionRepository.ts +65 -0
- package/full-service-imperative/app/repositories/contracts/IUserRepository.ts +55 -0
- package/full-service-imperative/app/services/CommentService.ts +109 -0
- package/full-service-imperative/app/services/PostService.ts +97 -0
- package/full-service-imperative/app/services/SecurityService.ts +224 -0
- package/full-service-imperative/app/services/SessionService.ts +124 -0
- package/full-service-imperative/app/services/UserService.ts +105 -0
- package/full-service-imperative/app/services/contracts/ICommentService.ts +62 -0
- package/full-service-imperative/app/services/contracts/IPostService.ts +53 -0
- package/full-service-imperative/app/services/contracts/ISecurityService.ts +97 -0
- package/full-service-imperative/app/services/contracts/ISessionService.ts +73 -0
- package/full-service-imperative/app/services/contracts/IUserService.ts +57 -0
- package/full-service-imperative/app/subscribers/UserEventSubscriber.ts +28 -0
- package/full-service-imperative/drizzle.config.ts +13 -0
- package/full-service-imperative/package.json +48 -0
- package/full-service-imperative/stone.config.mjs +12 -0
- package/full-service-imperative/tsconfig.json +25 -0
- package/full-service-imperative/vitest.config.ts +24 -0
- package/package.json +225 -0
- package/standard-react-declarative/LICENSE +21 -0
- package/standard-react-declarative/README.md +39 -0
- package/standard-react-declarative/app/Application.ts +45 -0
- package/standard-react-declarative/app/pages/welcome/WelcomePage.tsx +57 -0
- package/standard-react-declarative/app/services/WelcomeService.ts +38 -0
- package/standard-react-declarative/assets/css/index.css +26 -0
- package/standard-react-declarative/package.json +42 -0
- package/standard-react-declarative/tsconfig.json +33 -0
- package/standard-react-declarative/vitest.config.ts +24 -0
- package/standard-react-imperative/LICENSE +21 -0
- package/standard-react-imperative/README.md +39 -0
- package/standard-react-imperative/app/Application.ts +41 -0
- package/standard-react-imperative/app/pages/welcome/WelcomePage.tsx +50 -0
- package/standard-react-imperative/app/services/WelcomeService.ts +38 -0
- package/standard-react-imperative/assets/css/index.css +26 -0
- package/standard-react-imperative/package.json +42 -0
- package/standard-react-imperative/tsconfig.json +33 -0
- package/standard-react-imperative/vitest.config.ts +24 -0
- package/standard-service-declarative/LICENSE +21 -0
- package/standard-service-declarative/README.md +39 -0
- package/standard-service-declarative/app/Application.ts +39 -0
- package/standard-service-declarative/app/handlers/WelcomeEventHandler.ts +45 -0
- package/standard-service-declarative/app/services/WelcomeService.ts +38 -0
- package/standard-service-declarative/package.json +36 -0
- package/standard-service-declarative/tsconfig.json +25 -0
- package/standard-service-declarative/vitest.config.ts +24 -0
- package/standard-service-imperative/LICENSE +21 -0
- package/standard-service-imperative/README.md +39 -0
- package/standard-service-imperative/app/Application.ts +11 -0
- package/standard-service-imperative/app/handlers/welcomeEventHandler.ts +31 -0
- package/standard-service-imperative/app/services/welcomeService.ts +38 -0
- package/standard-service-imperative/package.json +35 -0
- package/standard-service-imperative/tsconfig.json +25 -0
- package/standard-service-imperative/vitest.config.ts +24 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* Reset and Global */
|
|
2
|
+
* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
color: #1c1e21;
|
|
10
|
+
background-color: #f5f6f8;
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
button {
|
|
15
|
+
border: none;
|
|
16
|
+
color: inherit;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
background: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Layout Container */
|
|
22
|
+
.app-layout {
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Header */
|
|
27
|
+
.app-header {
|
|
28
|
+
top: 0;
|
|
29
|
+
z-index: 10;
|
|
30
|
+
position: sticky;
|
|
31
|
+
background-color: #ffffff;
|
|
32
|
+
border-bottom: 1px solid #e5e7eb;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Main Layout */
|
|
36
|
+
.app-main {
|
|
37
|
+
gap: 2rem;
|
|
38
|
+
display: grid;
|
|
39
|
+
margin: 0 auto;
|
|
40
|
+
max-width: 1280px;
|
|
41
|
+
padding: 2rem 1rem;
|
|
42
|
+
padding: 2rem 1rem;
|
|
43
|
+
background-color: #f5f6f8;
|
|
44
|
+
grid-template-columns: 240px 1fr 300px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Left menu */
|
|
48
|
+
.main-left {
|
|
49
|
+
position: sticky;
|
|
50
|
+
top: 72px;
|
|
51
|
+
align-self: start;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Center feed */
|
|
55
|
+
.main-center {
|
|
56
|
+
min-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Right panel */
|
|
60
|
+
.main-right {
|
|
61
|
+
position: sticky;
|
|
62
|
+
top: 72px;
|
|
63
|
+
align-self: start;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Footer */
|
|
67
|
+
.app-footer {
|
|
68
|
+
padding: 1rem;
|
|
69
|
+
margin-top: 2rem;
|
|
70
|
+
margin-bottom: 1rem;
|
|
71
|
+
text-align: center;
|
|
72
|
+
/* background-color: #ffffff;
|
|
73
|
+
border-top: 1px solid #e5e7eb; */
|
|
74
|
+
font-size: 0.875rem;
|
|
75
|
+
color: #777;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Responsive */
|
|
79
|
+
@media (max-width: 1024px) {
|
|
80
|
+
.main-left {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.app-main {
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.content {
|
|
89
|
+
padding: 1rem;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (max-width: 640px) {
|
|
94
|
+
.header-right {
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
align-items: flex-end;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.user-details {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.dropdown-toggle {
|
|
104
|
+
font-size: 1.25rem;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import './AppLayout.css'
|
|
2
|
+
import { JSX } from 'react'
|
|
3
|
+
import { LayoutHeader } from '../../components/LayoutHeader/LayoutHeader'
|
|
4
|
+
import { LayoutLeftMenu } from '../../components/LayoutLeftMenu/LayoutLeftMenu'
|
|
5
|
+
import { RightAsidePanel } from '../../components/RightAsidePanel/RightAsidePanel'
|
|
6
|
+
import { definePageLayout, IPageLayout, PageLayoutRenderContext, StoneOutlet } from '@stone-js/use-react'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* App Layout component.
|
|
10
|
+
*/
|
|
11
|
+
export const AppLayout = (): IPageLayout => ({
|
|
12
|
+
/**
|
|
13
|
+
* Render the component.
|
|
14
|
+
*
|
|
15
|
+
* @param options - The options for rendering the component.
|
|
16
|
+
* @returns The rendered component.
|
|
17
|
+
*/
|
|
18
|
+
render ({ container, children }: PageLayoutRenderContext): JSX.Element {
|
|
19
|
+
return (
|
|
20
|
+
<div className='app-layout'>
|
|
21
|
+
<header className='app-header'>
|
|
22
|
+
<LayoutHeader container={container} />
|
|
23
|
+
</header>
|
|
24
|
+
|
|
25
|
+
<div className='app-main'>
|
|
26
|
+
<aside className='main-left'>
|
|
27
|
+
<LayoutLeftMenu container={container} />
|
|
28
|
+
</aside>
|
|
29
|
+
<main className='main-center'>
|
|
30
|
+
<StoneOutlet>{children}</StoneOutlet>
|
|
31
|
+
</main>
|
|
32
|
+
<aside className='main-right'>
|
|
33
|
+
<RightAsidePanel container={container} />
|
|
34
|
+
</aside>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<footer className='app-footer'>
|
|
38
|
+
Stone.js © 2025 Stone Foundation
|
|
39
|
+
</footer>
|
|
40
|
+
</div>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* App Layout blueprint.
|
|
47
|
+
*/
|
|
48
|
+
export const AppLayoutBlueprint = definePageLayout(AppLayout, { name: 'default' })
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import './ErrorLayout.css'
|
|
2
|
+
import { JSX } from 'react'
|
|
3
|
+
import { IPageLayout, StoneOutlet, PageLayoutRenderContext, definePageLayout } from '@stone-js/use-react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Error Page Layout.
|
|
7
|
+
*/
|
|
8
|
+
export const ErrorLayout = (): IPageLayout => ({
|
|
9
|
+
/**
|
|
10
|
+
* Render the component.
|
|
11
|
+
*
|
|
12
|
+
* @param options - The options for rendering the component.
|
|
13
|
+
* @returns The rendered component.
|
|
14
|
+
*/
|
|
15
|
+
render ({ children }: PageLayoutRenderContext): JSX.Element {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<header className='mt-64'>
|
|
19
|
+
<div className='container'>
|
|
20
|
+
<p className='pa-24'>
|
|
21
|
+
<img src='/logo.png' className='logo' alt='Stone.js Logo' />
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
</header>
|
|
25
|
+
<main>
|
|
26
|
+
<div className='container'>
|
|
27
|
+
<div className='panel'>
|
|
28
|
+
<StoneOutlet>{children}</StoneOutlet>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</main>
|
|
32
|
+
<footer className='mt-24'>
|
|
33
|
+
<div className='container'>
|
|
34
|
+
<p className='px-24 text-muted'>2025 Stone.js © Noowow Labs</p>
|
|
35
|
+
</div>
|
|
36
|
+
</footer>
|
|
37
|
+
</>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Error Page Layout Blueprint.
|
|
44
|
+
*/
|
|
45
|
+
export const ErrorLayoutBlueprint = definePageLayout(ErrorLayout, { name: 'error' })
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import './SecurityLayout.css'
|
|
2
|
+
import { JSX } from 'react'
|
|
3
|
+
import { IPageLayout, PageLayoutRenderContext, StoneOutlet, definePageLayout } from '@stone-js/use-react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Security Layout component.
|
|
7
|
+
*/
|
|
8
|
+
export const SecurityLayout = (): IPageLayout => ({
|
|
9
|
+
/**
|
|
10
|
+
* Render the component.
|
|
11
|
+
*
|
|
12
|
+
* @param options - The options for rendering the component.
|
|
13
|
+
* @returns The rendered component.
|
|
14
|
+
*/
|
|
15
|
+
render ({ children }: PageLayoutRenderContext): JSX.Element {
|
|
16
|
+
return (
|
|
17
|
+
<>
|
|
18
|
+
<header className='mt-64'>
|
|
19
|
+
<div className='container'>
|
|
20
|
+
<p className='pa-24'>
|
|
21
|
+
<img src='/logo.png' className='logo' alt='Stone.js Logo' />
|
|
22
|
+
</p>
|
|
23
|
+
</div>
|
|
24
|
+
</header>
|
|
25
|
+
<main>
|
|
26
|
+
<div className='container'>
|
|
27
|
+
<StoneOutlet>{children}</StoneOutlet>
|
|
28
|
+
</div>
|
|
29
|
+
</main>
|
|
30
|
+
<footer className='mt-24'>
|
|
31
|
+
<div className='container'>
|
|
32
|
+
<p className='px-24 text-muted'>2025 Stone.js © Noowow Labs</p>
|
|
33
|
+
</div>
|
|
34
|
+
</footer>
|
|
35
|
+
</>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Security Layout Blueprint.
|
|
42
|
+
*/
|
|
43
|
+
export const SecurityLayoutBlueprint = definePageLayout(SecurityLayout, { name: 'security' })
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* Reset and Global */
|
|
2
|
+
* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
color: #1c1e21;
|
|
10
|
+
background-color: #f5f6f8;
|
|
11
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
button {
|
|
15
|
+
border: none;
|
|
16
|
+
color: inherit;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
background: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Layout Container */
|
|
22
|
+
.app-layout {
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Header */
|
|
27
|
+
.app-header {
|
|
28
|
+
top: 0;
|
|
29
|
+
z-index: 10;
|
|
30
|
+
position: sticky;
|
|
31
|
+
background-color: #ffffff;
|
|
32
|
+
border-bottom: 1px solid #e5e7eb;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Main Layout */
|
|
36
|
+
.app-main {
|
|
37
|
+
gap: 2rem;
|
|
38
|
+
display: grid;
|
|
39
|
+
margin: 0 auto;
|
|
40
|
+
max-width: 1280px;
|
|
41
|
+
padding: 2rem 1rem;
|
|
42
|
+
padding: 2rem 1rem;
|
|
43
|
+
background-color: #f5f6f8;
|
|
44
|
+
grid-template-columns: 240px 1fr 300px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Left menu */
|
|
48
|
+
.main-left {
|
|
49
|
+
position: sticky;
|
|
50
|
+
top: 72px;
|
|
51
|
+
align-self: start;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Center feed */
|
|
55
|
+
.main-center {
|
|
56
|
+
min-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Footer */
|
|
60
|
+
.app-footer {
|
|
61
|
+
padding: 1rem;
|
|
62
|
+
margin-top: 2rem;
|
|
63
|
+
margin-bottom: 1rem;
|
|
64
|
+
text-align: center;
|
|
65
|
+
/* background-color: #ffffff;
|
|
66
|
+
border-top: 1px solid #e5e7eb; */
|
|
67
|
+
font-size: 0.875rem;
|
|
68
|
+
color: #777;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Responsive */
|
|
72
|
+
@media (max-width: 1024px) {
|
|
73
|
+
.main-left {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.app-main {
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.content {
|
|
82
|
+
padding: 1rem;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (max-width: 640px) {
|
|
87
|
+
.header-right {
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
align-items: flex-end;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.user-details {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.dropdown-toggle {
|
|
97
|
+
font-size: 1.25rem;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import './SettingsLayout.css'
|
|
2
|
+
import { JSX } from 'react'
|
|
3
|
+
import { LayoutHeader } from '../../components/LayoutHeader/LayoutHeader'
|
|
4
|
+
import { LayoutLeftMenu } from '../../components/LayoutLeftMenu/LayoutLeftMenu'
|
|
5
|
+
import { definePageLayout, IPageLayout, PageLayoutRenderContext, StoneOutlet } from '@stone-js/use-react'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* App Layout component.
|
|
9
|
+
*/
|
|
10
|
+
export const SettingsLayout = (): IPageLayout => ({
|
|
11
|
+
/**
|
|
12
|
+
* Render the component.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The options for rendering the component.
|
|
15
|
+
* @returns The rendered component.
|
|
16
|
+
*/
|
|
17
|
+
render ({ container, children }: PageLayoutRenderContext): JSX.Element {
|
|
18
|
+
return (
|
|
19
|
+
<div className='app-layout'>
|
|
20
|
+
<header className='app-header'>
|
|
21
|
+
<LayoutHeader container={container} />
|
|
22
|
+
</header>
|
|
23
|
+
|
|
24
|
+
<div className='app-main'>
|
|
25
|
+
<aside className='main-left'>
|
|
26
|
+
<LayoutLeftMenu container={container} />
|
|
27
|
+
</aside>
|
|
28
|
+
<main className='main-center'>
|
|
29
|
+
<StoneOutlet>{children}</StoneOutlet>
|
|
30
|
+
</main>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<footer className='app-footer'>
|
|
34
|
+
Stone.js © 2025 Stone Foundation
|
|
35
|
+
</footer>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* App Layout blueprint.
|
|
43
|
+
*/
|
|
44
|
+
export const SettingsLayoutBlueprint = definePageLayout(SettingsLayout, { name: 'settings' })
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IUserService } from '../services/contracts/IUserService'
|
|
2
|
+
import { ISecurityService } from '../services/contracts/ISecurityService'
|
|
3
|
+
import { defineMiddleware, FunctionalMiddleware, IBlueprint, NextMiddleware } from '@stone-js/core'
|
|
4
|
+
import { ReactIncomingEvent, ReactOutgoingResponse, reactRedirectResponse, ReactRuntime } from '@stone-js/use-react'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AuthMiddleware Options
|
|
8
|
+
*/
|
|
9
|
+
export interface AuthMiddlewareOptions {
|
|
10
|
+
blueprint: IBlueprint
|
|
11
|
+
userService: IUserService
|
|
12
|
+
reactRuntime: ReactRuntime
|
|
13
|
+
securityService: ISecurityService
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Set current user middleware
|
|
18
|
+
*/
|
|
19
|
+
export const AuthMiddleware = ({
|
|
20
|
+
blueprint,
|
|
21
|
+
userService,
|
|
22
|
+
reactRuntime,
|
|
23
|
+
securityService
|
|
24
|
+
}: AuthMiddlewareOptions): FunctionalMiddleware<ReactIncomingEvent, ReactOutgoingResponse> => {
|
|
25
|
+
/**
|
|
26
|
+
* Handle the incoming event
|
|
27
|
+
*
|
|
28
|
+
* @param event - The incoming event
|
|
29
|
+
* @param next - The next middleware
|
|
30
|
+
* @returns The response
|
|
31
|
+
*/
|
|
32
|
+
return async (
|
|
33
|
+
event: ReactIncomingEvent,
|
|
34
|
+
next: NextMiddleware<ReactIncomingEvent, ReactOutgoingResponse>,
|
|
35
|
+
excludes: string[] = []
|
|
36
|
+
): Promise<ReactOutgoingResponse> => {
|
|
37
|
+
if (!excludes.includes(event.pathname)) {
|
|
38
|
+
if (!securityService.isAuthenticated()) {
|
|
39
|
+
blueprint.set('app.requestedUrl', event.pathname)
|
|
40
|
+
return reactRedirectResponse({ url: '/login' })
|
|
41
|
+
}
|
|
42
|
+
const user = await reactRuntime.snapshot('currentUser', async () => await userService.current())
|
|
43
|
+
event.setUserResolver(() => user)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return await next(event)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* AuthMiddleware Blueprint
|
|
52
|
+
*/
|
|
53
|
+
export const AuthMiddlewareBlueprint = defineMiddleware(
|
|
54
|
+
AuthMiddleware,
|
|
55
|
+
{ global: true, params: [['/login', '/register']], isFactory: true }
|
|
56
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { User } from './User'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Comment Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface Comment {
|
|
7
|
+
id: number
|
|
8
|
+
author: User
|
|
9
|
+
content: string
|
|
10
|
+
authorId: number
|
|
11
|
+
postId: number
|
|
12
|
+
createdAt: number
|
|
13
|
+
likesCount: number
|
|
14
|
+
likedByCurrentUser: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* New Comment Interface
|
|
19
|
+
*/
|
|
20
|
+
export interface CommentInput {
|
|
21
|
+
id: number
|
|
22
|
+
content: string
|
|
23
|
+
postId: number
|
|
24
|
+
likesCount: number
|
|
25
|
+
likedByCurrentUser: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Comment View Interface
|
|
30
|
+
*/
|
|
31
|
+
export interface CommentView extends CommentInput {
|
|
32
|
+
author: User
|
|
33
|
+
createdAt: number
|
|
34
|
+
status?: 'idle' | 'saving' | 'error'
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { User } from './User'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post Interface
|
|
5
|
+
*/
|
|
6
|
+
export interface Post {
|
|
7
|
+
id: number
|
|
8
|
+
author: User
|
|
9
|
+
title: string
|
|
10
|
+
content: string
|
|
11
|
+
authorId: number
|
|
12
|
+
createdAt: number
|
|
13
|
+
updatedAt: number
|
|
14
|
+
imagePath?: string
|
|
15
|
+
likesCount: number
|
|
16
|
+
sharesCount: number
|
|
17
|
+
commentsCount: number
|
|
18
|
+
likedByCurrentUser: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* New Post Interface
|
|
23
|
+
*/
|
|
24
|
+
export interface PostInput {
|
|
25
|
+
title: string
|
|
26
|
+
content: string
|
|
27
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Interface
|
|
3
|
+
*/
|
|
4
|
+
export interface User {
|
|
5
|
+
id: number
|
|
6
|
+
name: string
|
|
7
|
+
bio?: string
|
|
8
|
+
email: string
|
|
9
|
+
avatar: string
|
|
10
|
+
coverImage: string
|
|
11
|
+
postCount: number
|
|
12
|
+
commentCount: number
|
|
13
|
+
isOnline: boolean
|
|
14
|
+
lastSeen: number
|
|
15
|
+
createdAt: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* New User Interface
|
|
20
|
+
*/
|
|
21
|
+
export interface UserInput {
|
|
22
|
+
name: string
|
|
23
|
+
email: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* User Login Interface
|
|
28
|
+
*/
|
|
29
|
+
export interface UserLogin {
|
|
30
|
+
email: string
|
|
31
|
+
password: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* User Register Interface
|
|
36
|
+
*/
|
|
37
|
+
export interface UserRegister {
|
|
38
|
+
name: string
|
|
39
|
+
email: string
|
|
40
|
+
password: string
|
|
41
|
+
confirmPassword: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* User Register Errors Type
|
|
46
|
+
*/
|
|
47
|
+
export type UserRegisterErrors = Record<string, string>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* User Change Password Interface
|
|
51
|
+
*/
|
|
52
|
+
export interface UserChangePassword {
|
|
53
|
+
password: string
|
|
54
|
+
newPassword: string
|
|
55
|
+
confirmPassword: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* User Token Interface
|
|
60
|
+
*/
|
|
61
|
+
export interface UserToken {
|
|
62
|
+
scope: string
|
|
63
|
+
stage: string
|
|
64
|
+
createdAt: number
|
|
65
|
+
expiresIn: number
|
|
66
|
+
tokenType: string
|
|
67
|
+
accessToken: string
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JSX } from 'react'
|
|
2
|
+
import { SettingsForm } from '../../components/SettingsForm/SettingsForm'
|
|
3
|
+
import { IPage, ReactIncomingEvent, definePage } from '@stone-js/use-react'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SettingsPage component.
|
|
7
|
+
*/
|
|
8
|
+
export const SettingsPage = (): IPage<ReactIncomingEvent> => ({
|
|
9
|
+
/**
|
|
10
|
+
* Render the component.
|
|
11
|
+
*
|
|
12
|
+
* @param options - The options for rendering the component.
|
|
13
|
+
* @returns The rendered component.
|
|
14
|
+
*/
|
|
15
|
+
render (): JSX.Element {
|
|
16
|
+
return <SettingsForm />
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SettingsPage Blueprint.
|
|
22
|
+
*/
|
|
23
|
+
export const SettingsPageBlueprint = definePage(SettingsPage, { path: '/settings', layout: 'settings' })
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { JSX } from 'react'
|
|
2
|
+
import { createPost } from '../utils'
|
|
3
|
+
import { Post } from '../../models/Post'
|
|
4
|
+
import { ILogger } from '@stone-js/core'
|
|
5
|
+
import { PostForm } from '../../components/PostForm/PostForm'
|
|
6
|
+
import { PostWidget } from '../../components/PostWidget/PostWidget'
|
|
7
|
+
import { IPostService } from '../../services/contracts/IPostService'
|
|
8
|
+
import { IPage, ReactIncomingEvent, HeadContext, definePage, IRouter, PageRenderContext } from '@stone-js/use-react'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* HomePage options.
|
|
12
|
+
*/
|
|
13
|
+
export interface HomePageOptions {
|
|
14
|
+
router: IRouter
|
|
15
|
+
logger: ILogger
|
|
16
|
+
postService: IPostService
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Home Page.
|
|
21
|
+
*/
|
|
22
|
+
export const HomePage = ({ router, logger, postService }: HomePageOptions): IPage<ReactIncomingEvent> => ({
|
|
23
|
+
head (): HeadContext {
|
|
24
|
+
return {
|
|
25
|
+
title: 'Home',
|
|
26
|
+
description: 'Welcome to the Stone.js timeline'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Handle the incoming event.
|
|
32
|
+
*
|
|
33
|
+
* @param event - The incoming event.
|
|
34
|
+
* @returns List of posts.
|
|
35
|
+
*/
|
|
36
|
+
async handle (event: ReactIncomingEvent): Promise<Post[]> {
|
|
37
|
+
return await postService.list(event.get<number>('limit', 10))
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Render the component.
|
|
42
|
+
*
|
|
43
|
+
* @returns The rendered component.
|
|
44
|
+
*/
|
|
45
|
+
render ({ data = [], event, container }: PageRenderContext<Post[]>): JSX.Element {
|
|
46
|
+
return (
|
|
47
|
+
<section>
|
|
48
|
+
<PostForm onSubmit={createPost.bind(this, router, logger, postService)} />
|
|
49
|
+
<PostWidget items={data} event={event} container={container} />
|
|
50
|
+
</section>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Home Page Blueprint.
|
|
57
|
+
*/
|
|
58
|
+
export const HomePageBlueprint = definePage(HomePage, { path: '/' })
|
|
File without changes
|