This repository has been archived by the owner on Dec 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from opencodeiiita/main
Deploying to prod
- Loading branch information
Showing
9 changed files
with
875 additions
and
473 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import React from 'react'; | ||
import React from "react"; | ||
import moment from "moment"; | ||
|
||
export default function FormResponse({ response }) { | ||
return ( | ||
<> | ||
<div className="border-2 rounded-lg"> | ||
<div className="p-4 flex flex-col"> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">Name:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Manas Gupta</div> | ||
</div> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">City:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Ludhiana</div> | ||
</div> | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm">State:</div> | ||
<div className="text-[#006bfb] font-base text-sm">Punjab</div> | ||
</div> | ||
<div className="self-end text-[#001e2b] italic text-xs"> | ||
Submittted a week ago | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
return ( | ||
<> | ||
<div className="border-2 rounded-lg"> | ||
<div className="p-4 flex flex-col"> | ||
{Object.entries(response.data).map((el) => ( | ||
<div className="flex flex-row gap-1"> | ||
<div className="text-[#001e2b] font-semibold text-sm"> | ||
{el[0]}: | ||
</div> | ||
<div className="text-[#006bfb] font-base text-sm"> | ||
{el[1]} | ||
</div> | ||
</div> | ||
))} | ||
<div className="self-end text-[#001e2b] italic text-xs"> | ||
{moment(response.createdAt).fromNow()} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,62 @@ | ||
const options = { | ||
email: { type: "string", format: "email" }, | ||
checkbox: { type: "boolean" }, | ||
color: { | ||
type: "string", | ||
pattern: "^#[0-9a-f]{3}([0-9a-f]{3})?$", | ||
}, | ||
date: { type: "string", format: "date" }, | ||
"datetime-local": { type: "string", format: "date-time" }, | ||
image: { | ||
type: "string", | ||
format: "uri", | ||
}, | ||
hidden: { type: "boolean" }, | ||
month: { type: "integer", minimum: 1, maximum: 12 }, | ||
number: { type: "number" }, | ||
radio: { type: "boolean" }, | ||
range: { type: "number" }, | ||
reset: { type: "boolean" }, | ||
search: { type: "string" }, | ||
tel: { | ||
type: "string", | ||
minLength: 10, | ||
maxLength: 20, | ||
pattern: "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$", | ||
}, | ||
text: { type: "string" }, | ||
time: { type: "string", format: "time" }, | ||
url: { type: "string", format: "uri" }, | ||
week: { type: "number", minimum: 1, maximum: 53 }, | ||
file: { type: "string", format: "uri" }, | ||
password: { type: "string" }, | ||
email: { type: "string", format: "email" }, | ||
checkbox: { type: "boolean" }, | ||
color: { | ||
type: "string", | ||
pattern: "^#[0-9a-f]{3}([0-9a-f]{3})?$", | ||
}, | ||
date: { type: "string", format: "date" }, | ||
"datetime-local": { type: "string", format: "date-time" }, | ||
image: { | ||
type: "string", | ||
format: "uri", | ||
}, | ||
hidden: { type: "boolean" }, | ||
month: { type: "integer", minimum: 1, maximum: 12 }, | ||
number: { type: "number" }, | ||
radio: { type: "boolean" }, | ||
range: { type: "number" }, | ||
reset: { type: "boolean" }, | ||
search: { type: "string" }, | ||
tel: { | ||
type: "string", | ||
minLength: 10, | ||
maxLength: 20, | ||
pattern: "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$", | ||
}, | ||
text: { type: "string" }, | ||
time: { type: "string", format: "time" }, | ||
url: { type: "string", format: "uri" }, | ||
week: { type: "number", minimum: 1, maximum: 53 }, | ||
file: { type: "string" }, | ||
password: { type: "string" }, | ||
}; | ||
|
||
const createJSONSchema = (inputs) => { | ||
let JSONSchema = { | ||
type: "object", | ||
properties: {}, | ||
required: [], | ||
additionalProperties: false, | ||
export const createJSONSchema = (inputs) => { | ||
let JSONSchema = { | ||
type: "object", | ||
properties: {}, | ||
required: [], | ||
additionalProperties: false, | ||
}; | ||
inputs.forEach((input) => { | ||
JSONSchema.properties[input.name] = options[input.type]; | ||
if (input.isRequired) { | ||
JSONSchema.required.push(input.name); | ||
} | ||
}); | ||
return JSONSchema; | ||
}; | ||
|
||
export const schemaToInputsConverter = (schema) => { | ||
const inputs = []; | ||
for (const [key, value] of Object.entries(schema.properties)) { | ||
const input = { | ||
name: key, | ||
type: value.type, | ||
isRequired: schema.required.includes(key), | ||
}; | ||
inputs.forEach((input) => { | ||
JSONSchema.properties[input.name] = options[input.type]; | ||
if (input.isRequired) { | ||
JSONSchema.required.push(input.name); | ||
} | ||
}); | ||
return JSONSchema; | ||
inputs.push(input); | ||
} | ||
return inputs; | ||
}; | ||
export default createJSONSchema; |
Oops, something went wrong.
d8be46c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
save-my-form-frontend-s61z – ./
save-my-form-frontend-s61z-git-prod-savemyform.vercel.app
savemyform.tk
save-my-form-frontend-s61z.vercel.app
www.savemyform.tk
save-my-form-frontend-s61z-savemyform.vercel.app