diff --git a/components/Loader.tsx b/components/Loader.tsx
index defef59..b48d6b1 100644
--- a/components/Loader.tsx
+++ b/components/Loader.tsx
@@ -2,7 +2,7 @@ import React from "react";
const Loader = () => {
return (
-
+
diff --git a/layout/Header.tsx b/layout/Header.tsx
index 46fdce0..6841dab 100644
--- a/layout/Header.tsx
+++ b/layout/Header.tsx
@@ -1,7 +1,10 @@
import { Button, Logo, SigninButton, ThemeToggle } from "@/components";
import { useAuth } from "@/context/AuthContext";
import { clsx } from "@/utils";
-import { ArrowLeftOnRectangleIcon } from "@heroicons/react/24/outline";
+import {
+ ArrowLeftOnRectangleIcon,
+ SparklesIcon,
+} from "@heroicons/react/24/outline";
import Link from "next/link";
import { useRouter } from "next/router";
@@ -17,7 +20,23 @@ const Header = () => {
-
+
{user?.uid ? (
<>
diff --git a/pages/explore/themes/index.tsx b/pages/explore/themes/index.tsx
new file mode 100644
index 0000000..d202af3
--- /dev/null
+++ b/pages/explore/themes/index.tsx
@@ -0,0 +1,27 @@
+import PublishedThemeListing from "@/components/explore/PublishedThemeListing";
+import Layout from "@/layout/Layout";
+import { SparklesIcon } from "@heroicons/react/24/outline";
+import React from "react";
+
+const PublishedThemes = () => {
+ return (
+
+
+
+ Explore themes
+
+
+
+ Explore and fork themes configured by other developers in community
+
+
+
+
+
+ );
+};
+
+export default PublishedThemes;
diff --git a/pages/profile.tsx b/pages/profile.tsx
index 6fa4607..2fdb409 100644
--- a/pages/profile.tsx
+++ b/pages/profile.tsx
@@ -193,6 +193,17 @@ const UserProfile = () => {
)
);
}}
+ onPublishChange={(themeId) => {
+ setSavedThemes(
+ [...savedThemes].map((theme) => {
+ if (theme.id === themeId) {
+ theme.isPublished =
+ !theme.isPublished;
+ }
+ return theme;
+ })
+ );
+ }}
/>
))}
diff --git a/pages/snippet/[uid].tsx b/pages/snippet/[uid].tsx
index ea68a07..f3efe3d 100644
--- a/pages/snippet/[uid].tsx
+++ b/pages/snippet/[uid].tsx
@@ -13,7 +13,7 @@ import { useEffect, useState } from "react";
// TODO: implement SSR
const SavedSnippet = () => {
const router = useRouter();
- const { setEditorConfig } = useSnippngEditor();
+ const { editorConfig, setEditorConfig } = useSnippngEditor();
const [notFound, setNotFound] = useState(false);
const [loadingConfig, setLoadingConfig] = useState(true);
@@ -53,6 +53,7 @@ const SavedSnippet = () => {
...defaultEditorConfig,
uid: undefined,
ownerUid: undefined,
+ owner: undefined,
});
};
}, [router.isReady]);
@@ -83,7 +84,45 @@ const SavedSnippet = () => {
);
- return
{loadingConfig ? : };
+ return (
+
+ {loadingConfig ? (
+
+ ) : (
+ <>
+
+
+
+
+
+
+
+
+
+
+ {editorConfig?.owner?.displayName || "Snippng user"}{" "}
+
+ Author
+
+
+
+ {editorConfig?.owner?.email || "Snippng user email"}
+
+
+
+
+
+ >
+ )}
+
+ );
};
export default SavedSnippet;
diff --git a/styles/globals.css b/styles/globals.css
index 2107df0..e15cbad 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -37,7 +37,7 @@ body {
}
.CodeMirror__Theme__Preview__Editor div.cm-editor {
- @apply pt-3 mb-10 border-[0.1px] dark:border-zinc-400 border-zinc-300 rounded-md;
+ @apply pt-3 mb-[6.5rem] border-[0.1px] dark:border-zinc-400 border-zinc-300 rounded-md;
}
.cm-scroller {
diff --git a/types/editor.ts b/types/editor.ts
index 1019332..1196aab 100644
--- a/types/editor.ts
+++ b/types/editor.ts
@@ -1,4 +1,5 @@
import { createTheme } from "@uiw/codemirror-themes";
+import { User } from "firebase/auth";
export interface SelectOptionInterface {
id: string;
@@ -8,9 +9,12 @@ export interface SelectOptionInterface {
export type CustomTheme = ReturnType
;
export interface SnippngThemeAttributesInterface {
id: string;
+ uid?: string;
label: string;
theme: "light" | "dark";
- isPublic?: boolean;
+ isPublished?: boolean;
+ owner?: Pick;
+ ownerUid?: string;
config: {
background: string;
foreground: string;
@@ -50,6 +54,7 @@ export type SnippngWindowControlsType =
export interface SnippngEditorConfigInterface {
ownerUid?: string;
+ owner?: Pick;
uid?: string;
watermark?: boolean;
code: string;
diff --git a/utils/index.ts b/utils/index.ts
index 90423d3..e75ea58 100644
--- a/utils/index.ts
+++ b/utils/index.ts
@@ -175,6 +175,7 @@ export const getExportableConfig = (
deepClonedConfig.bgImageVisiblePatch = null;
delete deepClonedConfig.uid;
delete deepClonedConfig.ownerUid;
+ delete deepClonedConfig.owner;
const exportableConfig: SnippngExportableConfig = deepClonedConfig;
return exportableConfig;
};