Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add form and return JSON #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

PrajwalArali
Copy link

@PrajwalArali PrajwalArali commented Dec 3, 2024

Closes Issue

Closes #11

Description

Added Form that takes the user input and logged them at console in JSON format.
/my-portfolio/manual-edit

Screenshot From 2024-12-03 08-58-16

Copy link

vercel bot commented Dec 3, 2024

@PrajwalArali is attempting to deploy a commit to the hikartik2004's projects Team on Vercel.

A member of the Team first needs to authorize it.

@hi-Kartik2004
Copy link
Owner

Hi @PrajwalArali,
Thanks for raising a PR, however It would be more appropriate if you could handle all the fields, specified here #11

I see you're handling most fields which accept simple single input, but missed the ones which are arrays.
For example this field projectDetails

 projectDetails: [
    {
      projectImage:
        "https://user-images.githubusercontent.com/111000515/251038755-3eed0115-7085-4b5c-8bee-9952b18adc09.png",
      projectTechStack: [
        "JavaScript",
        "PHP",
        "MySql",
        "HTML 5",
        "CSS 5",
        "Hack",
      ],
      projectHostedLink:
        "https://learn-stock-trading.000webhostapp.com/?home=firstTime",
      projectType: "fullstack",
      projectName:
        "Trading Arena - Real Time Stock Trading Simulation / Stocks Playground",
      projectGithubLink: "https://github.com/hi-Kartik2004/TradingApp",
      projectDescription:
        "Users can browse live stocks as per National stock exchange - India. Upon signup, users are credited with Rs 1lac (virtual currency) to buy and sell stocks, with the amount credited based on the latest stock prices.",
      projectId: 0,
    },
    {
      projectGithubLink: "https://github.com/hi-Kartik2004/CodeFury-6.0",
      projectType: "fullstack",
      projectName: "Digital Clinic - A Web App Addressing Mental Health Issues",
      projectDescription:
        "This application offers various features such as Mental Health Assessment, Social Media & Articles Summariser, Articles on improving mental health & digital wellbeing, Community Articles, and more.",
      projectId: 1,
      projectImage:
        "https://user-images.githubusercontent.com/111000515/282149083-1d053699-0281-4c93-a6fb-2b646d7bbd1b.png",
      projectHostedLink:
        "https://digital-clinic.000webhostapp.com/?home=firstTime",
      projectTechStack: [
        "Rest APIs",
        "AJAX",
        "JavaScript",
        "PHP",
        "MySql",
        "HTML 5",
        "CSS 5",
        "Hack",
      ],
    },

Let me know if you need more clarity.

@hi-Kartik2004
Copy link
Owner

hi-Kartik2004 commented Dec 3, 2024

You can also handle the update portfolio json logic, the implementation is here

Simply replace the value of the key named portfolioCode in your session storage when the user submits the form.
and call this function (in order to make a call you first would need to export this function from it's original file and import it in your .../my-portfolio/manual-edit/page.js file)

@@ -10,7 +10,7 @@
},
"dependencies": {
"@babel/standalone": "^7.23.3",
"@clerk/nextjs": "^4.27.1",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to change the versions too
But no worries, I'll ignore them during merge.

Comment on lines +5 to +39
const ManualEditPage = () => {
const [formData, setFormData] = useState({
FirstName: "",
LastName: "",
NavName: "",
NavSubtitle: "",
image: "",
AboutImageLeft: "",
AboutImageCenter: "",
AboutImageRight: "",
linkedinUrl: "",
resumeLink: "",
githubId: "",
email: "",
WhatsAppLink: "",
HeroGradient: "",
HeroTitle: "",
HeroSubtitle: "",
AboutTitle: "",
AboutTitleGradient: "",
AboutMockCode: "",
AboutBadge: "",
AboutDescription: "",
AboutMainDescription: "",
AboutOtherDescription: "",
ProjectTitle: "",
ProjectTitleGradient: "",
ProjectDescription: "",
ProjectBadge: "",
SkillsBadge: "",
FooterDescription: "",
FooterBadge: "",
FootTitle: "",
FooterSliderTitle: "",
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer #11 for all the fields required in the form

Comment on lines +46 to +50
const handleSubmit = (e) => {
e.preventDefault();
console.log("Generated JSON:", JSON.stringify(formData, null, 2));
alert("JSON generated! Check the console for details.");
};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle update portfolio code in firestore!
Function to do the same

Comment on lines +66 to +74
<input
type="text"
id={key}
name={key}
value={formData[key]}
onChange={handleChange}
placeholder={`Enter ${key}`}
className="w-full px-4 py-3 rounded bg-gray-900 text-white border border-gray-700 focus:outline-none focus:ring-2 focus:ring-pink-500"
/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their is a component <Input /> (note capital i)
Use it instead for standard styling across the whole app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Ui to create the portfolio json.
2 participants