Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simple-charts-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mahesh Maddhuru
simple-charts-frontend
Commits
83b97a8c
Commit
83b97a8c
authored
10 months ago
by
mjpsoohoo
Browse files
Options
Downloads
Patches
Plain Diff
Restructured resource
parent
518eac35
Branches
main
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/Resources/resource-tab.tsx
+71
-0
71 additions, 0 deletions
src/components/Resources/resource-tab.tsx
with
71 additions
and
0 deletions
src/components/Resources/resource-tab.tsx
0 → 100644
+
71
−
0
View file @
83b97a8c
"
use client
"
;
import
Breadcrumb
from
"
@/components/Breadcrumbs/Breadcrumb
"
;
import
DefaultLayout
from
"
@/components/Layouts/DefaultLayout
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
Tabs
,
Tab
}
from
"
@mui/material
"
;
import
{
usePathname
}
from
"
next/navigation
"
;
import
ResourceTile
from
"
@/components/Resources/resource-tile
"
;
const
ResourceTab
=
()
=>
{
const
[
activeTab
,
setActiveTab
]
=
React
.
useState
(
0
);
const
pathname
=
usePathname
();
const
handleTabChange
=
(
event
:
React
.
ChangeEvent
<
{}
>
,
newValue
:
number
)
=>
{
setActiveTab
(
newValue
);
};
const
[
resources
,
setResources
]
=
useState
<
any
[]
>
([]);
// const pathname = usePathname();
useEffect
(()
=>
{
fetchData
();
},
[]);
const
fetchData
=
async
()
=>
{
try
{
const
response
=
await
fetch
(
"
https://simplecharts.maheshlabs.com/api/resources?resource-category-id=
"
+
"
1
"
,
);
const
data
=
await
response
.
json
();
setResources
(
data
);
}
catch
(
error
)
{
console
.
error
(
"
Error fetching resources:
"
,
error
);
}
};
return
(
<
div
>
<
Tabs
value
=
{
activeTab
}
onChange
=
{
handleTabChange
}
aria-label
=
"Choose Data tabs"
>
{
/* Make below tabs bold */
}
<
Tab
label
=
"Workshop Slides"
/>
<
Tab
label
=
"Activity Books"
/>
<
Tab
label
=
"Auto-Graded Activities"
/>
<
Tab
label
=
"Activities Created by Teachers"
/>
</
Tabs
>
<
div
role
=
"tabpanel"
hidden
=
{
activeTab
!==
0
}
>
{
/* Content for Choose Sample tab */
}
<
ResourceTile
></
ResourceTile
>
{
/* Add grid to display images */
}
</
div
>
<
div
role
=
"tabpanel"
hidden
=
{
activeTab
!==
1
}
>
{
/* Content for Create Data tab */
}
{
/* Add form to create CSV data */
}
</
div
>
<
div
role
=
"tabpanel"
hidden
=
{
activeTab
!==
2
}
>
{
/* Content for Upload File tab */
}
{
/* Add file upload input */
}
</
div
>
</
div
>
);
};
export
default
ResourceTab
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment