Skip to content

Commit 00b0a8e

Browse files
authored
Merge branch 'initialClassification' into GP-10
2 parents 6e236dc + cfb8ed9 commit 00b0a8e

File tree

14 files changed

+1290
-58
lines changed

14 files changed

+1290
-58
lines changed
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { ReactNode, useEffect } from 'react';
2+
// import { useHistory } from 'react-router-dom';
3+
import Link from 'next/link';
4+
import Layout from '../../components/Section/Layout';
5+
import { Auth, ThemeSupa } from '@supabase/auth-ui-react';
6+
import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react';
7+
import { useRouter } from 'next/router';
8+
9+
export function SupabaseAuthWrapper({ children }: { children: ReactNode }) {
10+
return (
11+
<div className='flex min-h-full flex-col justify-center pt-10 sm:px-6 lg:px-8'>
12+
<div className='sm:mx-auto sm:w-full sm:max-w-md'>
13+
<div className='bg-white py-8 px-4 shadow-xl ring-1 ring-gray-900/10 sm:rounded-lg sm:px-10 dark:bg-white dark:text-gray-900'>
14+
<div className='-mt-8'>
15+
{children}
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
);
21+
};
22+
23+
interface AuthPageProps {
24+
children: ReactNode;
25+
}
26+
27+
export function AuthPage({ children }: AuthPageProps) {
28+
// const history = useHistory();
29+
const session = useSession();
30+
const router = useRouter();
31+
32+
// useEffect(() => {
33+
// if (session) {
34+
// router.push('/')
35+
// }
36+
// }, [session, history]);
37+
38+
return (
39+
<SupabaseAuthWrapper>
40+
{children}
41+
</SupabaseAuthWrapper>
42+
);
43+
};
44+
45+
export default function LoginPage() {
46+
const supabase = useSupabaseClient();
47+
48+
return (
49+
<AuthPage>
50+
<Auth supabaseClient={supabase} appearance={{ theme: ThemeSupa }} theme='dark' />
51+
<br />
52+
<span className='text-sm font-medium text-gray-900 dark:text-gray-900'>
53+
Don't have an account yet?{' '}
54+
<Link href='/signup' className='underline'>
55+
go to signup
56+
</Link>
57+
.
58+
</span>
59+
<br />
60+
</AuthPage>
61+
);
62+
};

components/Content/ClassificationFeed.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function ClassificationFeed({ custommaxWidth = '85%' }) {
99
const [posts, setPosts] = useState([]);
1010
// const [profile, setProfile] = useState(null);
1111
const [planetPosts, setPlanetPosts] = useState([]);
12-
12+
1313
useEffect(() => {
1414
fetchPosts();
1515
}, []);
+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
import Image from "next/image";
2+
import Link from "next/link";
3+
4+
import { formatDateString } from "../../../lib/threads";
5+
// Import for deleting a post
6+
7+
interface Props {
8+
id: string;
9+
currentUserId: string;
10+
parentId: string | null;
11+
content: string;
12+
author: {
13+
name: string;
14+
image: string;
15+
id: string;
16+
};
17+
community: {
18+
id: string;
19+
name: string;
20+
image: string;
21+
} | null;
22+
createdAt: string;
23+
comments: {
24+
author: {
25+
image: string;
26+
};
27+
}[];
28+
isComment?: boolean;
29+
};
30+
31+
function PostCard({
32+
id,
33+
currentUserId,
34+
parentId,
35+
content,
36+
author,
37+
community,
38+
createdAt,
39+
comments,
40+
isComment,
41+
}: Props) {
42+
return (
43+
<article
44+
className={`flex w-full flex-col rounded-xl ${
45+
isComment ? "px-0 xs:px-7" : "bg-dark-2 p-7"
46+
}`}
47+
>
48+
<div className='flex items-start justify-between'>
49+
<div className='flex w-full flex-1 flex-row gap-4'>
50+
<div className='flex flex-col items-center'>
51+
<Link href={`/profile/${author.id}`} className='relative h-11 w-11'>
52+
<Image
53+
src={author.image}
54+
alt='user_community_image'
55+
fill
56+
className='cursor-pointer rounded-full'
57+
/>
58+
</Link>
59+
60+
<div className='thread-card_bar' />
61+
</div>
62+
63+
<div className='flex w-full flex-col'>
64+
<Link href={`/profile/${author.id}`} className='w-fit'>
65+
<h4 className='cursor-pointer text-base-semibold text-light-1'>
66+
{author.name}
67+
</h4>
68+
</Link>
69+
70+
<p className='mt-2 text-small-regular text-light-2'>{content}</p>
71+
72+
<div className={`${isComment && "mb-10"} mt-5 flex flex-col gap-3`}>
73+
<div className='flex gap-3.5'>
74+
<Image
75+
src='/assets/heart-gray.svg'
76+
alt='heart'
77+
width={24}
78+
height={24}
79+
className='cursor-pointer object-contain'
80+
/>
81+
<Link href={`/thread/${id}`}>
82+
<Image
83+
src='/assets/reply.svg'
84+
alt='heart'
85+
width={24}
86+
height={24}
87+
className='cursor-pointer object-contain'
88+
/>
89+
</Link>
90+
<Image
91+
src='/assets/repost.svg'
92+
alt='heart'
93+
width={24}
94+
height={24}
95+
className='cursor-pointer object-contain'
96+
/>
97+
<Image
98+
src='/assets/share.svg'
99+
alt='heart'
100+
width={24}
101+
height={24}
102+
className='cursor-pointer object-contain'
103+
/>
104+
</div>
105+
106+
{isComment && comments.length > 0 && (
107+
<Link href={`/thread/${id}`}>
108+
<p className='mt-1 text-subtle-medium text-gray-1'>
109+
{comments.length} repl{comments.length > 1 ? "ies" : "y"}
110+
</p>
111+
</Link>
112+
)}
113+
</div>
114+
</div>
115+
</div>
116+
</div>
117+
118+
{!isComment && comments.length > 0 && (
119+
<div className='ml-1 mt-3 flex items-center gap-2'>
120+
{comments.slice(0, 2).map((comment, index) => (
121+
<Image
122+
key={index}
123+
src={comment.author.image}
124+
alt={`user_${index}`}
125+
width={24}
126+
height={24}
127+
className={`${index !== 0 && "-ml-5"} rounded-full object-cover`}
128+
/>
129+
))}
130+
131+
<Link href={`/thread/${id}`}>
132+
<p className='mt-1 text-subtle-medium text-gray-1'>
133+
{comments.length} repl{comments.length > 1 ? "ies" : "y"}
134+
</p>
135+
</Link>
136+
</div>
137+
)}
138+
139+
{!isComment && community && (
140+
<Link
141+
href={`/communities/${community.id}`}
142+
className='mt-5 flex items-center'
143+
>
144+
<p className='text-subtle-medium text-gray-1'>
145+
{formatDateString(createdAt)}
146+
{community && ` - ${community.name} Community`}
147+
</p>
148+
149+
<Image
150+
src={community.image}
151+
alt={community.name}
152+
width={14}
153+
height={14}
154+
className='ml-1 rounded-full object-cover'
155+
/>
156+
</Link>
157+
)}
158+
</article>
159+
);
160+
}
161+
162+
export default PostCard;

components/Public/LandingContent.tsx

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
3+
export const navigation = [
4+
{
5+
name: 'Litepaper', href: '#litepaper'
6+
},
7+
{
8+
name: 'Modules', href: '#modules'
9+
},
10+
{
11+
name: 'Documentation', href: '#documentation'
12+
},
13+
{
14+
name: 'Open Source', href: 'https://github.com/signal-k/'
15+
},
16+
];
17+
18+
export const modules = [
19+
{
20+
name: 'Planet Hunters',
21+
description: 'Employ simple data-science tools to discover real planets and add them to your collection',
22+
icon: '🪐',
23+
href: '/garden', // We should probably provide landing pages for each "module" which leads into the documentation. A good pre-cursor to the onboarding components
24+
},
25+
{
26+
name: 'Desert Exploration', // Need to come up with a more suitable name
27+
description: 'Take photos with the Mars rovers and discuss your findings with your faction',
28+
icon: '📸',
29+
href: '/garden',
30+
},
31+
{
32+
name: 'Planet Huners',
33+
description: 'Employ simple data-science tools to discover real planets and add them to your collection',
34+
icon: '🪐',
35+
href: '/garden',
36+
},
37+
{
38+
name: 'Planet Hters',
39+
description: 'Employ simple data-science tools to discover real planets and add them to your collection',
40+
icon: '🪐',
41+
href: '/garden',
42+
},
43+
];
44+
45+
export const footerNavigation = {
46+
app: [ // Possibly should add icons as well
47+
{
48+
name: 'Documentation', href: '/',
49+
},
50+
{
51+
name: 'Open-source', href: '/',
52+
},
53+
{
54+
name: 'Datasets', href: '/',
55+
},
56+
{
57+
name: 'Knowledge Base', href: '/', // Something like a public deta module of all anytype, etc
58+
},
59+
],
60+
company: [
61+
{
62+
name: 'made by Talonova Aerospace', href: 'https://talonova.space',
63+
},
64+
{
65+
name: 'a subsidiary of Talon Group', href: 'https://group.talonova.space',
66+
},
67+
{
68+
name: 'Designed by Liam Arbuckle', href: 'https://www.linkedin.com/in/liam-arbuckle-8bb257188/',
69+
},
70+
],
71+
};

components/Section/Layout.tsx

+34-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,39 @@ const Layout: React.FC<DashboardLayoutProps> = ({ children }) => {
4444

4545
export default Layout;
4646

47+
export const LandingLayout: React.FC<DashboardLayoutProps> = ({ children }) => {
48+
const [isMobile, setIsMobile] = useState(false);
49+
50+
useEffect(() => { // Check if window is defined before accessing it
51+
if (typeof window !== "undefined") {
52+
const checkIsMobile = () => {
53+
setIsMobile(window.innerWidth <= 768);
54+
};
55+
checkIsMobile();
56+
window.addEventListener("resize", checkIsMobile);
57+
return () => {
58+
window.removeEventListener("resize", checkIsMobile);
59+
};
60+
}
61+
}, []);
62+
63+
return (
64+
<>
65+
<main className="h-max pb-10 grow pt-6">
66+
<div className="py-12">
67+
{children}
68+
</div>
69+
</main>
70+
{isMobile && (
71+
<div className="md:hidden overflow-y-auto h-screen p-4">
72+
<main className="h-max pb-10 grow">{children}</main>
73+
{/* <Bottombar /> */}
74+
</div>
75+
)}
76+
</>
77+
);
78+
};
79+
4780
export const InventoryLayout: React.FC<DashboardLayoutProps> = ({ children }) => {
4881
const [isMobile, setIsMobile] = useState(false);
4982
const [activeTab, setActiveTab] = useState('consumables')
@@ -65,7 +98,7 @@ export const InventoryLayout: React.FC<DashboardLayoutProps> = ({ children }) =>
6598
<>
6699
<main className="h-max pb-10 grow pt-6">
67100
<Navbar />
68-
<div className="py-5"><center><div className="py-12"><InventoryMenu setActiveTab={setActiveTab} /></div></center></div>
101+
<div className="py-8"><center><div className="py-12"><InventoryMenu setActiveTab={setActiveTab} /></div></center></div>
69102
<div className="py-12">
70103
{children}
71104
</div>

0 commit comments

Comments
 (0)