Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
josetano2 committed Aug 23, 2024
2 parents 8e7fe87 + dac4324 commit 9a1f5f4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 36 deletions.
10 changes: 5 additions & 5 deletions src/ss_frontend/src/components/HomePost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const HomePost = ({ postId, choosePost }) => {
</div>
<p className='text-base '>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Atque labore sit velit laborum adipisci tenetur, quas assumenda culpa ipsa quasi explicabo cum nostrum facere est tempora corrupti, obcaecati, porro dolor!</p>
<div className='w-full flex justify-start gap-4 p-4 overflow-x-scroll'>
<img className='max-w-52 max-h-36 px rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 px rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 px rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 px rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 px rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 rounded-lg' src={blank} alt="" />
<img className='max-w-52 max-h-36 rounded-lg' src={blank} alt="" />
</div>
</div>
</div>
Expand Down
18 changes: 11 additions & 7 deletions src/ss_frontend/src/components/MiddleHomePart.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import React from 'react'
import TextInput from './TextInput'
import HomePost from './HomePost'
import { useAuth } from '../hooks/UseAuth'

const MiddleHomePart = ({setCurrPost}) => {
const MiddleHomePart = ({ setCurrPost }) => {
const { isAuthenticated } = useAuth();
return (
<div className='w-1/2 h-full '>
<TextInput />
<div className='mt-5 flex flex-col gap-6'>
<HomePost choosePost={setCurrPost} postId={"dummy"}/>
<HomePost choosePost={setCurrPost} postId={"dummy"}/>
</div>
<div className='w-1/2 h-full flex flex-col justify-start'>
{
isAuthenticated && <TextInput />
}
<div className=' flex flex-col gap-6'>
<HomePost choosePost={setCurrPost} postId={"dummy"} />
<HomePost choosePost={setCurrPost} postId={"dummy"} />
</div>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/ss_frontend/src/components/ProfileSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ProfileSidebar = () => {
useEffect(() => {
console.log(data);

if (!isLoading) {
if (!isLoading && data != undefined) {
if (data.ok) {
setUsername(data.ok.username);
setName(data.ok.name)
Expand Down
62 changes: 39 additions & 23 deletions src/ss_frontend/src/components/TextInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TextInput = () => {
return;
}

console.log(inputText);
console.log(inputText)

try {
const response = await fetch(
Expand Down Expand Up @@ -50,6 +50,8 @@ const TextInput = () => {
const url = await uploadImage(file, setLoading);
if (url) {
setImages((prevImages) => [...prevImages, url]);
console.log(images);

} else {
throw new Error("Failed to upload image.");
}
Expand All @@ -69,28 +71,42 @@ const TextInput = () => {
};

return (
<div className="flex justify-between items-center gap-5">
<input
type="text"
placeholder="Type here"
className="input input-bordered pt-6 pb-6 w-full"
value={inputText}
onChange={(e) => setInputText(e.target.value)}
/>
<input
type="file"
ref={fileInputRef}
style={{ display: "none" }}
onChange={handleImage}
/>
<LuImagePlus
className="text-4xl cursor-pointer"
onClick={handleImageClick}
/>
<HiOutlinePaperAirplane
className="text-4xl cursor-pointer"
onClick={handleSend}
/>
<div className="mb-5">
<h1 className="pl-[1rem] text-xl font-medium">Any project you wanna share?</h1>
<div className="flex justify-between items-center gap-5">
<input
type="text"
placeholder="Type here"
className="input pt-6 pb-6 w-full focus:outline-none focus:border-transparent"
value={inputText}
onChange={(e) => setInputText(e.target.value)}
/>
<input
type="file"
ref={fileInputRef}
style={{ display: "none" }}
onChange={handleImage}
/>
<LuImagePlus
className="text-4xl cursor-pointer"
onClick={handleImageClick}
/>
<HiOutlinePaperAirplane
className="text-4xl cursor-pointer"
onClick={handleSend}
/>
</div>
{images.length != 0 &&
<div className="items-center w-full flex justify-start gap-4 p-4 overflow-x-scroll">
{images.map((imageUrl) => {
return(
<div className="">
<img src={imageUrl} className="max-w-52 max-h-36 rounded-lg" alt="" />
</div>
)
})}
</div>
}
</div>
);
};
Expand Down
Empty file added src/testing_motoko/main.mo
Empty file.

0 comments on commit 9a1f5f4

Please sign in to comment.