@portosaur/theme 0.1.0
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/README.md +13 -0
- package/assets/img/icon-old.png +0 -0
- package/assets/img/icon.png +0 -0
- package/assets/img/project-blank.png +0 -0
- package/assets/img/social-card.jpeg +0 -0
- package/assets/img/svg/icon-blog.svg +2 -0
- package/assets/img/svg/icon-close.svg +3 -0
- package/assets/img/svg/icon-dock.svg +4 -0
- package/assets/img/svg/icon-link.svg +5 -0
- package/assets/img/svg/icon-note.svg +2 -0
- package/assets/img/svg/icon-popup.svg +1 -0
- package/assets/img/svg/icon-save.svg +5 -0
- package/assets/img/svg/icon.svg +240 -0
- package/assets/img/svg/project-blank.svg +140 -0
- package/assets/sample-resume.pdf +0 -0
- package/package.json +41 -0
- package/plugins/README.md +8 -0
- package/src/index.d.ts +11 -0
- package/src/index.mjs +14 -0
- package/src/plugins/theme.mjs +13 -0
- package/theme/DocCategoryGeneratedIndexPage/index.jsx +15 -0
- package/theme/MDXComponents.jsx +19 -0
- package/theme/README.md +9 -0
- package/theme/Root.jsx +11 -0
- package/theme/components/AboutSection/index.jsx +264 -0
- package/theme/components/AboutSection/styles.module.css +309 -0
- package/theme/components/ContactSection/index.jsx +188 -0
- package/theme/components/ContactSection/styles.module.css +343 -0
- package/theme/components/ExperienceSection/index.jsx +119 -0
- package/theme/components/ExperienceSection/styles.module.css +183 -0
- package/theme/components/HeroSection/index.jsx +198 -0
- package/theme/components/HeroSection/styles.module.css +484 -0
- package/theme/components/NavArrow/index.jsx +124 -0
- package/theme/components/NavArrow/styles.module.css +107 -0
- package/theme/components/NoteIndex/index.jsx +182 -0
- package/theme/components/NoteIndex/styles.module.css +167 -0
- package/theme/components/Preview/components/FeedbackStates.jsx +200 -0
- package/theme/components/Preview/components/FileTabs.jsx +41 -0
- package/theme/components/Preview/components/PreviewContent.jsx +104 -0
- package/theme/components/Preview/components/PreviewHeader.jsx +411 -0
- package/theme/components/Preview/components/Triggers/Pv.jsx +253 -0
- package/theme/components/Preview/components/Triggers/SrcPv.jsx +55 -0
- package/theme/components/Preview/components/Triggers/index.jsx +2 -0
- package/theme/components/Preview/components/ViewerWindow.jsx +489 -0
- package/theme/components/Preview/hooks/useAdaptiveSizing.jsx +90 -0
- package/theme/components/Preview/hooks/useDeepLinkHash.jsx +24 -0
- package/theme/components/Preview/hooks/useDockLayout.jsx +86 -0
- package/theme/components/Preview/hooks/useFileFetch.jsx +38 -0
- package/theme/components/Preview/hooks/useTouchZoom.jsx +98 -0
- package/theme/components/Preview/index.jsx +3 -0
- package/theme/components/Preview/renderers/CodeRenderer.jsx +124 -0
- package/theme/components/Preview/renderers/ImageRenderer.jsx +74 -0
- package/theme/components/Preview/renderers/PdfRenderer.jsx +93 -0
- package/theme/components/Preview/renderers/WebRenderer.jsx +59 -0
- package/theme/components/Preview/state/index.jsx +177 -0
- package/theme/components/Preview/styles.module.css +776 -0
- package/theme/components/Preview/utils/index.jsx +62 -0
- package/theme/components/ProjectsSection/index.jsx +790 -0
- package/theme/components/ProjectsSection/styles.module.css +900 -0
- package/theme/components/SocialLinks/index.jsx +115 -0
- package/theme/components/SocialLinks/styles.module.css +57 -0
- package/theme/components/Tooltip/index.jsx +104 -0
- package/theme/components/Tooltip/styles.module.css +168 -0
- package/theme/config/iconMappings.jsx +427 -0
- package/theme/config/prism.jsx +72 -0
- package/theme/config/sidebar.jsx +11 -0
- package/theme/css/bootstrap.css +5 -0
- package/theme/css/catppuccin.css +618 -0
- package/theme/css/custom.css +253 -0
- package/theme/css/tasks.css +874 -0
- package/theme/hooks/useScrollReveal.jsx +20 -0
- package/theme/pages/index.jsx +104 -0
- package/theme/pages/notes.jsx +131 -0
- package/theme/pages/tasks.jsx +989 -0
- package/theme/utils/HashNavigation.jsx +185 -0
- package/theme/utils/updateTitle.jsx +65 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import useBaseUrl from "@docusaurus/useBaseUrl";
|
|
2
|
+
import { usePluginData } from "@docusaurus/useGlobalData";
|
|
3
|
+
import Link from "@docusaurus/Link";
|
|
4
|
+
import { FaBook, FaChevronRight } from "react-icons/fa";
|
|
5
|
+
import Tooltip from "../Tooltip/index.js";
|
|
6
|
+
import { iconMap } from "../../config/iconMappings.js";
|
|
7
|
+
import DocCardList from "@theme/DocCardList";
|
|
8
|
+
import styles from "./styles.module.css";
|
|
9
|
+
function useNotes() {
|
|
10
|
+
const context = require.context(`@site/notes`, true, /index\.mdx?$|\.mdx?$/);
|
|
11
|
+
return context
|
|
12
|
+
.keys()
|
|
13
|
+
.filter((path) => {
|
|
14
|
+
if (path === "./index.md" || path === "./index.mdx") return false;
|
|
15
|
+
const pathParts = path.split("/");
|
|
16
|
+
const isTopLevelFile =
|
|
17
|
+
pathParts.length === 2 && !path.match(/index\.mdx?$/);
|
|
18
|
+
const isTopLevelDir =
|
|
19
|
+
pathParts.length === 3 && path.match(/index\.mdx?$/);
|
|
20
|
+
return isTopLevelFile || isTopLevelDir;
|
|
21
|
+
})
|
|
22
|
+
.map((path) => {
|
|
23
|
+
const { frontMatter } = context(path);
|
|
24
|
+
const pathParts = path.split("/");
|
|
25
|
+
const isTopLevelFile = pathParts.length === 2;
|
|
26
|
+
const fileSlug = isTopLevelFile
|
|
27
|
+
? path.replace("./", "").replace(/\.mdx?$/, "")
|
|
28
|
+
: pathParts[1];
|
|
29
|
+
const slug = frontMatter.slug || frontMatter.id || fileSlug;
|
|
30
|
+
const rawTitle = frontMatter.title || frontMatter.language || fileSlug;
|
|
31
|
+
const title = rawTitle.charAt(0).toUpperCase() + rawTitle.slice(1);
|
|
32
|
+
const language = frontMatter.language
|
|
33
|
+
? frontMatter.language
|
|
34
|
+
.toLowerCase()
|
|
35
|
+
.replace(/ /g, "")
|
|
36
|
+
.replace(/[\s-]/g, "")
|
|
37
|
+
: slug.toLowerCase() || title.toLowerCase();
|
|
38
|
+
return {
|
|
39
|
+
title,
|
|
40
|
+
language,
|
|
41
|
+
slug,
|
|
42
|
+
desc: frontMatter.desc || "",
|
|
43
|
+
position: frontMatter.sidebar_position || 999,
|
|
44
|
+
};
|
|
45
|
+
})
|
|
46
|
+
.sort((a, b) => a.position - b.position);
|
|
47
|
+
}
|
|
48
|
+
function NoteCard({ title, language, slug, desc, index, docsBasePath }) {
|
|
49
|
+
const noteUrl = useBaseUrl(`${docsBasePath}/${slug}`);
|
|
50
|
+
const { icon: Icon = FaBook, color = "var(--ifm-color-primary)" } =
|
|
51
|
+
iconMap[language] || iconMap[title.toLowerCase()] || {};
|
|
52
|
+
const tooltipContent = desc ? desc : null;
|
|
53
|
+
const cardInner = jsxDEV_7x81h0kn(
|
|
54
|
+
Link,
|
|
55
|
+
{
|
|
56
|
+
to: noteUrl,
|
|
57
|
+
className: styles.noteCard,
|
|
58
|
+
style: { "--card-index": index, "--note-color": color },
|
|
59
|
+
"aria-label": `Read note: ${title}`,
|
|
60
|
+
children: [
|
|
61
|
+
jsxDEV_7x81h0kn(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: styles.iconWrapper,
|
|
65
|
+
children: jsxDEV_7x81h0kn(
|
|
66
|
+
Icon,
|
|
67
|
+
{ className: styles.noteIcon },
|
|
68
|
+
undefined,
|
|
69
|
+
false,
|
|
70
|
+
undefined,
|
|
71
|
+
this,
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
undefined,
|
|
75
|
+
false,
|
|
76
|
+
undefined,
|
|
77
|
+
this,
|
|
78
|
+
),
|
|
79
|
+
jsxDEV_7x81h0kn(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: styles.cardContent,
|
|
83
|
+
children: jsxDEV_7x81h0kn(
|
|
84
|
+
"h3",
|
|
85
|
+
{ className: styles.noteTitle, children: title },
|
|
86
|
+
undefined,
|
|
87
|
+
false,
|
|
88
|
+
undefined,
|
|
89
|
+
this,
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
undefined,
|
|
93
|
+
false,
|
|
94
|
+
undefined,
|
|
95
|
+
this,
|
|
96
|
+
),
|
|
97
|
+
jsxDEV_7x81h0kn(
|
|
98
|
+
FaChevronRight,
|
|
99
|
+
{ className: styles.mobileChevron },
|
|
100
|
+
undefined,
|
|
101
|
+
false,
|
|
102
|
+
undefined,
|
|
103
|
+
this,
|
|
104
|
+
),
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
undefined,
|
|
108
|
+
true,
|
|
109
|
+
undefined,
|
|
110
|
+
this,
|
|
111
|
+
);
|
|
112
|
+
return tooltipContent
|
|
113
|
+
? jsxDEV_7x81h0kn(
|
|
114
|
+
Tooltip,
|
|
115
|
+
{
|
|
116
|
+
msg: tooltipContent,
|
|
117
|
+
position: "top",
|
|
118
|
+
underline: false,
|
|
119
|
+
gap: -8,
|
|
120
|
+
children: cardInner,
|
|
121
|
+
},
|
|
122
|
+
undefined,
|
|
123
|
+
false,
|
|
124
|
+
undefined,
|
|
125
|
+
this,
|
|
126
|
+
)
|
|
127
|
+
: cardInner;
|
|
128
|
+
}
|
|
129
|
+
export default function NoteCards() {
|
|
130
|
+
const notes = useNotes();
|
|
131
|
+
const { path: docsBasePath } = usePluginData(
|
|
132
|
+
"docusaurus-plugin-content-docs",
|
|
133
|
+
);
|
|
134
|
+
if (!notes.length) return null;
|
|
135
|
+
return jsxDEV_7x81h0kn(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
className: styles.notesGrid,
|
|
139
|
+
role: "list",
|
|
140
|
+
children: notes.map((note, index) =>
|
|
141
|
+
jsxDEV_7x81h0kn(
|
|
142
|
+
NoteCard,
|
|
143
|
+
{ ...note, index, docsBasePath },
|
|
144
|
+
note.slug,
|
|
145
|
+
false,
|
|
146
|
+
undefined,
|
|
147
|
+
this,
|
|
148
|
+
),
|
|
149
|
+
),
|
|
150
|
+
},
|
|
151
|
+
undefined,
|
|
152
|
+
false,
|
|
153
|
+
undefined,
|
|
154
|
+
this,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
export function TopicList({
|
|
158
|
+
desc = "Click on the links below to explore the topics.",
|
|
159
|
+
style = { marginTop: "-2.5rem", marginBottom: "2.5rem", textAlign: "center" },
|
|
160
|
+
}) {
|
|
161
|
+
return jsxDEV_7x81h0kn(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
style,
|
|
165
|
+
children: [
|
|
166
|
+
jsxDEV_7x81h0kn(
|
|
167
|
+
"p",
|
|
168
|
+
{ dangerouslySetInnerHTML: { __html: desc } },
|
|
169
|
+
undefined,
|
|
170
|
+
false,
|
|
171
|
+
undefined,
|
|
172
|
+
this,
|
|
173
|
+
),
|
|
174
|
+
jsxDEV_7x81h0kn(DocCardList, {}, undefined, false, undefined, this),
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
undefined,
|
|
178
|
+
true,
|
|
179
|
+
undefined,
|
|
180
|
+
this,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
@keyframes noteFadeIn {
|
|
2
|
+
from {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
transform: translateY(15px);
|
|
5
|
+
}
|
|
6
|
+
to {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
transform: translateY(0);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.notesGrid {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
gap: 1rem;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
margin: 2rem 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.noteCard {
|
|
21
|
+
width: 200px;
|
|
22
|
+
min-height: 220px;
|
|
23
|
+
background-color: var(--ifm-card-background-color);
|
|
24
|
+
border-radius: var(--ifm-card-border-radius);
|
|
25
|
+
padding: 1.5rem 1rem;
|
|
26
|
+
text-decoration: none !important;
|
|
27
|
+
color: var(--ifm-font-color-base) !important;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
position: relative;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
transition: all 0.3s ease;
|
|
35
|
+
animation: noteFadeIn 0.5s ease-out forwards;
|
|
36
|
+
animation-delay: calc(0.1s + (var(--card-index, 0) * 0.05s));
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.noteCard:hover {
|
|
41
|
+
transform: translateY(-8px) scale(1.03);
|
|
42
|
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.iconWrapper {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
margin-bottom: 1.5rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.noteIcon {
|
|
53
|
+
font-size: 3.5rem;
|
|
54
|
+
color: var(--note-color);
|
|
55
|
+
transition: transform 0.3s ease;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.noteCard:hover .noteIcon {
|
|
59
|
+
transform: scale(1.1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.noteTitle {
|
|
63
|
+
margin: 0;
|
|
64
|
+
font-size: 1.6rem;
|
|
65
|
+
font-weight: 700;
|
|
66
|
+
line-height: 1.3;
|
|
67
|
+
text-align: center;
|
|
68
|
+
display: -webkit-box;
|
|
69
|
+
-webkit-line-clamp: 2;
|
|
70
|
+
line-clamp: 2;
|
|
71
|
+
-webkit-box-orient: vertical;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
text-overflow: ellipsis;
|
|
74
|
+
overflow-wrap: anywhere;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Mobile List Style */
|
|
78
|
+
.mobileChevron {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media (max-width: 480px) {
|
|
83
|
+
.notesGrid {
|
|
84
|
+
gap: 0.65rem;
|
|
85
|
+
margin: 0.2rem 0;
|
|
86
|
+
padding: 0 0.2rem;
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
align-items: stretch;
|
|
90
|
+
justify-content: flex-start;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Force the Tooltip container to be full-width */
|
|
94
|
+
.notesGrid > span {
|
|
95
|
+
width: 100%;
|
|
96
|
+
display: flex !important;
|
|
97
|
+
justify-content: flex-start;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.noteCard {
|
|
101
|
+
width: 100%;
|
|
102
|
+
min-height: auto;
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
align-items: center;
|
|
105
|
+
padding: 0.95rem 1.2rem;
|
|
106
|
+
justify-content: flex-start;
|
|
107
|
+
background-color: var(--ifm-card-background-color);
|
|
108
|
+
border-radius: 12px;
|
|
109
|
+
box-shadow: var(--ifm-global-shadow-md);
|
|
110
|
+
gap: 1.2rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.noteCard:hover {
|
|
114
|
+
transform: none;
|
|
115
|
+
background-color: var(--ifm-hover-overlay);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.iconWrapper {
|
|
119
|
+
margin: 0;
|
|
120
|
+
flex-shrink: 0;
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.noteIcon {
|
|
127
|
+
font-size: 2.8rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.cardContent {
|
|
131
|
+
text-align: left;
|
|
132
|
+
flex: 1;
|
|
133
|
+
min-width: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.noteTitle {
|
|
137
|
+
font-size: 1.2rem;
|
|
138
|
+
font-weight: 600;
|
|
139
|
+
color: var(--ifm-font-color-base);
|
|
140
|
+
-webkit-line-clamp: 2;
|
|
141
|
+
line-clamp: 2;
|
|
142
|
+
overflow-wrap: anywhere;
|
|
143
|
+
text-align: left;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.mobileChevron {
|
|
147
|
+
display: block;
|
|
148
|
+
margin-left: auto;
|
|
149
|
+
font-size: 1.1rem;
|
|
150
|
+
opacity: 0.7;
|
|
151
|
+
color: var(--ifm-color-primary);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.noteCard:active {
|
|
155
|
+
transform: scale(0.98);
|
|
156
|
+
background-color: var(--ifm-hover-overlay);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Accessibility */
|
|
161
|
+
@media (prefers-reduced-motion: reduce) {
|
|
162
|
+
.noteCard {
|
|
163
|
+
animation: none;
|
|
164
|
+
opacity: 1;
|
|
165
|
+
transition: none;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import styles from "../styles.module.css";
|
|
2
|
+
export function LoadingState() {
|
|
3
|
+
return jsxDEV_7x81h0kn(
|
|
4
|
+
"div",
|
|
5
|
+
{
|
|
6
|
+
className: styles.loading,
|
|
7
|
+
children: [
|
|
8
|
+
jsxDEV_7x81h0kn(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: styles.loadingIcon,
|
|
12
|
+
children: jsxDEV_7x81h0kn(
|
|
13
|
+
"div",
|
|
14
|
+
{ className: styles.spinner },
|
|
15
|
+
undefined,
|
|
16
|
+
false,
|
|
17
|
+
undefined,
|
|
18
|
+
this,
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
undefined,
|
|
22
|
+
false,
|
|
23
|
+
undefined,
|
|
24
|
+
this,
|
|
25
|
+
),
|
|
26
|
+
jsxDEV_7x81h0kn(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: styles.loadingText,
|
|
30
|
+
children: [
|
|
31
|
+
jsxDEV_7x81h0kn(
|
|
32
|
+
"p",
|
|
33
|
+
{ children: "Preparing preview..." },
|
|
34
|
+
undefined,
|
|
35
|
+
false,
|
|
36
|
+
undefined,
|
|
37
|
+
this,
|
|
38
|
+
),
|
|
39
|
+
jsxDEV_7x81h0kn(
|
|
40
|
+
"span",
|
|
41
|
+
{ children: "Fetching content from source" },
|
|
42
|
+
undefined,
|
|
43
|
+
false,
|
|
44
|
+
undefined,
|
|
45
|
+
this,
|
|
46
|
+
),
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
undefined,
|
|
50
|
+
true,
|
|
51
|
+
undefined,
|
|
52
|
+
this,
|
|
53
|
+
),
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
undefined,
|
|
57
|
+
true,
|
|
58
|
+
undefined,
|
|
59
|
+
this,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
export function ErrorState({ path, message, fileType, fileUrl, onRetry }) {
|
|
63
|
+
return jsxDEV_7x81h0kn(
|
|
64
|
+
"div",
|
|
65
|
+
{
|
|
66
|
+
className: styles.errorState,
|
|
67
|
+
children: [
|
|
68
|
+
jsxDEV_7x81h0kn(
|
|
69
|
+
"div",
|
|
70
|
+
{ className: styles.errorIcon, children: "⚠️" },
|
|
71
|
+
undefined,
|
|
72
|
+
false,
|
|
73
|
+
undefined,
|
|
74
|
+
this,
|
|
75
|
+
),
|
|
76
|
+
jsxDEV_7x81h0kn(
|
|
77
|
+
"p",
|
|
78
|
+
{
|
|
79
|
+
children: [
|
|
80
|
+
"Could not load: ",
|
|
81
|
+
jsxDEV_7x81h0kn(
|
|
82
|
+
"code",
|
|
83
|
+
{ children: path?.split("/").pop() },
|
|
84
|
+
undefined,
|
|
85
|
+
false,
|
|
86
|
+
undefined,
|
|
87
|
+
this,
|
|
88
|
+
),
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
undefined,
|
|
92
|
+
true,
|
|
93
|
+
undefined,
|
|
94
|
+
this,
|
|
95
|
+
),
|
|
96
|
+
jsxDEV_7x81h0kn(
|
|
97
|
+
"p",
|
|
98
|
+
{ className: styles.errorMsg, children: message },
|
|
99
|
+
undefined,
|
|
100
|
+
false,
|
|
101
|
+
undefined,
|
|
102
|
+
this,
|
|
103
|
+
),
|
|
104
|
+
jsxDEV_7x81h0kn(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: styles.errorActions,
|
|
108
|
+
children: [
|
|
109
|
+
jsxDEV_7x81h0kn(
|
|
110
|
+
"button",
|
|
111
|
+
{
|
|
112
|
+
onClick: onRetry,
|
|
113
|
+
className: styles.retryButton,
|
|
114
|
+
children: "Retry",
|
|
115
|
+
},
|
|
116
|
+
undefined,
|
|
117
|
+
false,
|
|
118
|
+
undefined,
|
|
119
|
+
this,
|
|
120
|
+
),
|
|
121
|
+
fileType === "web" &&
|
|
122
|
+
jsxDEV_7x81h0kn(
|
|
123
|
+
"a",
|
|
124
|
+
{
|
|
125
|
+
href: fileUrl,
|
|
126
|
+
target: "_blank",
|
|
127
|
+
rel: "noopener",
|
|
128
|
+
className: styles.visitButton,
|
|
129
|
+
children: "Visit Website",
|
|
130
|
+
},
|
|
131
|
+
undefined,
|
|
132
|
+
false,
|
|
133
|
+
undefined,
|
|
134
|
+
this,
|
|
135
|
+
),
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
undefined,
|
|
139
|
+
true,
|
|
140
|
+
undefined,
|
|
141
|
+
this,
|
|
142
|
+
),
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
undefined,
|
|
146
|
+
true,
|
|
147
|
+
undefined,
|
|
148
|
+
this,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
export function OfflineState({ onRetry }) {
|
|
152
|
+
return jsxDEV_7x81h0kn(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: styles.errorState,
|
|
156
|
+
children: [
|
|
157
|
+
jsxDEV_7x81h0kn(
|
|
158
|
+
"div",
|
|
159
|
+
{ className: styles.errorIcon, children: "\uD83D\uDCE1" },
|
|
160
|
+
undefined,
|
|
161
|
+
false,
|
|
162
|
+
undefined,
|
|
163
|
+
this,
|
|
164
|
+
),
|
|
165
|
+
jsxDEV_7x81h0kn(
|
|
166
|
+
"h3",
|
|
167
|
+
{ children: "No Connection" },
|
|
168
|
+
undefined,
|
|
169
|
+
false,
|
|
170
|
+
undefined,
|
|
171
|
+
this,
|
|
172
|
+
),
|
|
173
|
+
jsxDEV_7x81h0kn(
|
|
174
|
+
"p",
|
|
175
|
+
{ children: "This resource requires an active internet connection." },
|
|
176
|
+
undefined,
|
|
177
|
+
false,
|
|
178
|
+
undefined,
|
|
179
|
+
this,
|
|
180
|
+
),
|
|
181
|
+
jsxDEV_7x81h0kn(
|
|
182
|
+
"button",
|
|
183
|
+
{
|
|
184
|
+
onClick: onRetry,
|
|
185
|
+
className: styles.retryButton,
|
|
186
|
+
children: "Try Again",
|
|
187
|
+
},
|
|
188
|
+
undefined,
|
|
189
|
+
false,
|
|
190
|
+
undefined,
|
|
191
|
+
this,
|
|
192
|
+
),
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
undefined,
|
|
196
|
+
true,
|
|
197
|
+
undefined,
|
|
198
|
+
this,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import styles from "../styles.module.css";
|
|
3
|
+
export default function FileTabs({ sources, activeIndex, onSelect }) {
|
|
4
|
+
const tabRefs = useRef([]);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const el = tabRefs.current[activeIndex];
|
|
7
|
+
if (el) {
|
|
8
|
+
el.scrollIntoView({
|
|
9
|
+
behavior: "smooth",
|
|
10
|
+
block: "nearest",
|
|
11
|
+
inline: "center",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}, [activeIndex]);
|
|
15
|
+
if (!sources || sources.length <= 1) return null;
|
|
16
|
+
return jsxDEV_7x81h0kn(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: styles.tabs,
|
|
20
|
+
children: sources.map((src, i) =>
|
|
21
|
+
jsxDEV_7x81h0kn(
|
|
22
|
+
"button",
|
|
23
|
+
{
|
|
24
|
+
ref: (el) => (tabRefs.current[i] = el),
|
|
25
|
+
className: `${styles.tab} ${i === activeIndex ? styles.activeTab : ""}`,
|
|
26
|
+
onClick: () => onSelect(i),
|
|
27
|
+
children: src.label || src.path.split("/").pop(),
|
|
28
|
+
},
|
|
29
|
+
i,
|
|
30
|
+
false,
|
|
31
|
+
undefined,
|
|
32
|
+
this,
|
|
33
|
+
),
|
|
34
|
+
),
|
|
35
|
+
},
|
|
36
|
+
undefined,
|
|
37
|
+
false,
|
|
38
|
+
undefined,
|
|
39
|
+
this,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styles from "../styles.module.css";
|
|
3
|
+
import { LoadingState, ErrorState, OfflineState } from "./FeedbackStates";
|
|
4
|
+
import ImageRenderer from "../renderers/ImageRenderer";
|
|
5
|
+
import PdfRenderer from "../renderers/PdfRenderer";
|
|
6
|
+
import WebRenderer from "../renderers/WebRenderer";
|
|
7
|
+
import CodeRenderer from "../renderers/CodeRenderer";
|
|
8
|
+
export default function PreviewContent({
|
|
9
|
+
currentFile,
|
|
10
|
+
fileType,
|
|
11
|
+
fileUrl,
|
|
12
|
+
isOnline,
|
|
13
|
+
fetchErrors,
|
|
14
|
+
textLoading,
|
|
15
|
+
textContent,
|
|
16
|
+
zoomLevel,
|
|
17
|
+
ext,
|
|
18
|
+
retryFetch,
|
|
19
|
+
setError,
|
|
20
|
+
}) {
|
|
21
|
+
const path = currentFile?.path;
|
|
22
|
+
const isExternal = path?.startsWith("http") || path?.startsWith("//");
|
|
23
|
+
if (!isOnline && isExternal) {
|
|
24
|
+
return jsxDEV_7x81h0kn(
|
|
25
|
+
OfflineState,
|
|
26
|
+
{ onRetry: retryFetch },
|
|
27
|
+
undefined,
|
|
28
|
+
false,
|
|
29
|
+
undefined,
|
|
30
|
+
this,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const errorMsg = fetchErrors?.[path];
|
|
34
|
+
if (errorMsg) {
|
|
35
|
+
return jsxDEV_7x81h0kn(
|
|
36
|
+
ErrorState,
|
|
37
|
+
{ path, message: errorMsg, fileType, fileUrl, onRetry: retryFetch },
|
|
38
|
+
undefined,
|
|
39
|
+
false,
|
|
40
|
+
undefined,
|
|
41
|
+
this,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (textLoading && fileType === "text") {
|
|
45
|
+
return jsxDEV_7x81h0kn(LoadingState, {}, undefined, false, undefined, this);
|
|
46
|
+
}
|
|
47
|
+
switch (fileType) {
|
|
48
|
+
case "image":
|
|
49
|
+
return jsxDEV_7x81h0kn(
|
|
50
|
+
ImageRenderer,
|
|
51
|
+
{
|
|
52
|
+
fileUrl,
|
|
53
|
+
label: currentFile.label,
|
|
54
|
+
zoomLevel,
|
|
55
|
+
onError: (msg) => setError(path, msg),
|
|
56
|
+
},
|
|
57
|
+
fileUrl,
|
|
58
|
+
false,
|
|
59
|
+
undefined,
|
|
60
|
+
this,
|
|
61
|
+
);
|
|
62
|
+
case "pdf":
|
|
63
|
+
return jsxDEV_7x81h0kn(
|
|
64
|
+
PdfRenderer,
|
|
65
|
+
{ fileUrl, zoomLevel, onError: (msg) => setError(path, msg) },
|
|
66
|
+
fileUrl,
|
|
67
|
+
false,
|
|
68
|
+
undefined,
|
|
69
|
+
this,
|
|
70
|
+
);
|
|
71
|
+
case "web":
|
|
72
|
+
return jsxDEV_7x81h0kn(
|
|
73
|
+
WebRenderer,
|
|
74
|
+
{
|
|
75
|
+
fileUrl,
|
|
76
|
+
label: currentFile.label,
|
|
77
|
+
onError: (msg) => setError(path, msg),
|
|
78
|
+
},
|
|
79
|
+
fileUrl,
|
|
80
|
+
false,
|
|
81
|
+
undefined,
|
|
82
|
+
this,
|
|
83
|
+
);
|
|
84
|
+
default: {
|
|
85
|
+
if (!textContent)
|
|
86
|
+
return jsxDEV_7x81h0kn(
|
|
87
|
+
LoadingState,
|
|
88
|
+
{},
|
|
89
|
+
undefined,
|
|
90
|
+
false,
|
|
91
|
+
undefined,
|
|
92
|
+
this,
|
|
93
|
+
);
|
|
94
|
+
return jsxDEV_7x81h0kn(
|
|
95
|
+
CodeRenderer,
|
|
96
|
+
{ code: textContent, language: ext, zoomLevel },
|
|
97
|
+
undefined,
|
|
98
|
+
false,
|
|
99
|
+
undefined,
|
|
100
|
+
this,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|