Migrating the Library app to the T3 stack will enable smoother development for the planned features involving user login and submissions, and proxying requests between the frontend and the Directus backend. The strict type safety in the config will also encourage more resilient code, improve the dev experience, and prevent runtime errors.
https://create.t3.gg/en/installation
pnpm create t3-app@latest
side note - using pnpm
package manager https://pnpm.io/next/installation
Look at package.json
in existing repo
Install dependencies that we think we will use - can add more later as we need
pnpm add @chakra-ui/icons @chakra-ui/next-js @chakra-ui/react @directus/sdk@10 @emotion/react @emotion/styled @nikolovlazar/chakra-ui-prose axios date-fns date-fns-tz html-react-parser html-to-text next-plausible next-seo parameterize plaiceholder react-hook-form react-icons react-lite-youtube-embed react-scroll-up unist-util-visit
Copy over old ChakraUI files needed to new repo
_app.tsx
Copied over the next-auth config from veym-biz-directory
azure-ad-b2c
provider, using jwtenv.js
In Azure Portal add the callback URL to the MembershipTest2
App Registration
Ignored and quick-patched a lot of typescript errors. Will need to add true fixes and refactor a lot of it later.
Add a custom extension to Directus instance on ITApps VM to auto-generate a typescript types definition file for the directus schema
docker-compose.yml
for this directus instance to mount the extensions directory from the host machinechown
to make sure the user has accessNote: whenever changes are made to the Directus schema (adding collections, fields, etc), the types file will need to be regenerated and copied into the repo.
veym.app
domain - Google Domainspnpm i domhandler@^4
v13
and it workspublicProcedure
or privateProcedure
adminProcedure
can be added in the futurev10
version of the sdk. They rewrote it for v11
with a completely different interfacectx
object
api
useQuery
for getting datauseMutation
for sending something to the servershortcut to change color mode: Ctrl/Cmd
+ K
check for logged in using the useSession hook from next-auth
const {
data: sessionData,
status: sessionStatus,
update: updateSession,
} = useSession();
const isLoggedIn = sessionStatus === "authenticated"; // shortcut
can check isLoggedIn
variable to conditionally do/show stuff if the user is logged in