- Navbar implemented
- Navbar styling using classnames pkg (it makes conditional styling very easy)
- Seting up prisma,configuring .env database-url
- datagrid configured and db is working correctly connection tested-ok
- prisma client is working
- post request created app>api>issues>route.tsx,zod used,thnuderclient or postman
- daisy ui is working
- issue page created with daisyui
- created new issue page and added markdown editor
- data stored in db used simple fetch to hit post request and useRouter hook to redirect to previous page
- const data = await prisma.issue.findMany(); just this much code to retrive data from database and do whatever you want to do with that data
- added skeleton loading in loading.tsx and used npm pkg react-loading-skeleton to do so this pkg makes it very easy to implement skeleton loading in any app.
- added [id] folder and fetch unique data form DB using prisma
- added page.tsx in id and seperate loading for that page
- app/components/issuebadge is created and it takes props as string
- added style to this page
- added delay to enhance ui/ux and used delay npm pkg
- loading.tsx added in [id]>loading.tsx and used react-skeleton pkg
- editor in issues/new page is ssr but requires client side events so we make it client component
- refactoring and organising all imports in components folder
Created many pathc api and created reusable component in _components folder (the _component folder will not appera in routing coz it starts with _ it is good conventioncompanies uses) many updatrs hav been added and bugs fixes
- refer code fro Issueform inside _components folder , api>issues>[id]>route.tsx
- kind of mess happened in code 😓
- fixed caching issue
- to referesh the page, so to do that we have several options but most commonly used client side method is call-> router.referesh() after router.push('/issue/edit') etc pages
- reactsimpleMDE editor which is present in edit and new issues files is maked client side using this const IssueForm=dynamic(()=>import('@/app/issues/components/IssueForm'),{ssr:false ,loading:()=>})
- added seperate loading.tsx in new and edit issue folder and rendered using abovee loading:()=> loading.tsx->cmp
- added one loading.tsx in _components folder to make it reusable and reuse it in edit and new issues page.tsx
-
refresh the issue page and click on create new issue page and see skeleton loading of parent is showing first then html is rendered need to fix it
-
same bug in edit issue age and new issue page not fixed till now
- this is a bug presnet in current version of next js however we can slove thi by breaking the hierarchy of the routes but i am not fixing it coz it will make route ugly and refer 47.7
-
api created to delete issue form db (alway screate a api req wehenever you need to communicate with DB)
-
DeleteIssuebutton added to issue>[id]>DeleteIssueButton.tsx containes all the code to delete issue also using fetch delete to delete the data from db
-
imporving loading and added spinner in delete button
- refer this docs https://next-auth.js.org/providers/google
- watch mosh from 48.1,49.2,50.3 to setup next-auth
- do as he does and ou will get results
- successfully implemented next-auth
- added these button in navbar cmp also used session refer 51.4
- styling these links
- seperated these links in different files and created LoginCard.tsx app>components/LoginCard.tsx
- created login links in NavBar.tsx
-login links are apperarign after some time so we added skeleton loading to improve user experience
-
most imp reviously we are using AUTH_SECRET but we are next-auth so use NEXTAUTH_SECRET NEXTAUTH_SECRET
-
while using AUTH_SECRET as secret name ithis error is occuring [next-auth][warn][NO_SECRET] https://next-auth.js.org/warnings#no_secret
-
NEXTAUTH_SECRET=Ah78Knw2bjrdOy2puqeLujL5YgKY2N37EDE/+gbrA+E= #no need to wrap it in string but it is fine
-
always use NEXTAUTH if you are using next-auth -->NEXTAUTH_URL=http://localhost:3000 #no need to wrap it in string but it is fine
- create a new middleware.tsx at the root level
- Middleware functoin is a function that gets executed on each request , all the requests that we define in middleware.tsx file in his object export const config={ matcher:[ '/issues/new', '/issues/:id/edit' ] }
- used getServerSession in C:\Users\HP\Desktop\nextjs-projects\issuetrackerapp\app\issues[id]\page.tsx this file
- used session if true then display btns else not
- in each api>auth>routes we define getServerSession( Provider object ) Provider obj path-app/auth/ProviderObjext.ts
- in each POST DELETE request we define this and if(!session) then we sended nextresonse ad 401 unauthenticated
- this cmp is used assign issue to users is present in issues/_cmps folder
- assign cmp full working with fetch
- every time fetch is not good so we are using react quwery to do so
- created seperate branch for fetch
-
we have used tankstack.com React Query to fetch and cach data in efficient way now need to to fetch data every time we edit issue or etc
-
created ReactQuery.tsx in app>ReactQuery.tsx and imported it in layout.tsx and wrap all body cmp to ReactQuer
-
React Query worked dont check type at useQuery instead check it later on.....
- created relation between user and issue schema 62.5
- Updated PATCH request in ap>api>issues>[id]>route.tsx, created new zod schema, 43.6
- tested api using postman and all done
- implemented assignee full function if one issue is assigned to a user and if we reload the page , the previously assigned user will show
- Refactored assigne cmp
- added filterComponent of daisy ui to issue page
- filter component fully implemented with full functionalities
- from next/navigation I used router
- router.push,filter cpm file created and some updates IssuePagecmp
bug fixes if user enters wrong query http://localhost:3000/issues?filterBy=OPENasd
- const status=Object.values(Status) console.log(status); const finalStatus=status.includes(filterBy)?filterBy:undefined; const data = await prisma.issue.findMany({ where: { status: finalStatus } });
- this code is used 68.2
-
Link href={/issues?filterBy=${filterBy}&orderBy=${value}}> th
-
ausing between issuepage file making filter query
-
added filter issue with column name and by status (open close in progress)
-
some bugs in 71.5 but not fixed filter url issue not fixed
- generated dummy data for issue page
- created pagination cmp in global cmps folder
- it uses use router and use searchparams hook
- working properly
- fully woring pagination done
-
created LatestIssue.tsx to fetch 5 latest issue from db
-
created layout for dashboard to show issues with logo of user to whome the issue is assigned
-
used
const data = await prisma.issue.findMany({ where: { status: finalStatus }, orderBy: orderBy ? { {[orderBy]}: "asc" } : undefined, skip: (Page - 1) * pageSize, take: pageSize, });and const issues = await prisma.issue.findMany({ orderBy: { createdAt: "desc" }, take: 5, include: { assignToUser: true }, }); this type of new params in prisa query skip take and include
- refer dashboard page and issue for details
- new file addded in alldashboardCMP > IssueSummary.tsx
- in dash board created 3 cards showing total issues with status
- made the issue summary card clickable to apply filterBy
- created issueBarChart in alldashboardCMP
- added bar chart cmp to home page-landing page
- added ue friendlty ui and styled al cmps and made them responsive
- meta data means
the text inside this img is meta data
- code used export const metadata:Metadata ={ title: "Issue Tracker - View All Issues", description: "All Issues Here", }
here more key-value are available but for this instance we only define title and description we can also add image etc ....
- just add above code in the bottom bo the page where you want to change meta data
- issuetrackerapp\app\issues[id]\page.tsx
- in this xmp we are requesting 2 quereis for same data so instead we used react cache to get data once and can be used
- const fetchUser=cache((issueId: number) => prisma.issue.findUnique({ where: { id: issueId } }));
- always create dummy .env file so that other users can use your repo
- it is a tool to track all issues bugs in our app and inform use when issue occur in user app
- mysql cant be deployed on production coz planetscale is not giving free access and others also
- may be in future will try
- dated 06-07-2024