Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Karol-2 committed Jan 2, 2024
1 parent 243071e commit f82e9aa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 36 deletions.
1 change: 0 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
- name: Test the backend
run: cd backend; npm i && npm run test run


# - name: Format files
# run: cd ..; npm i && npm run prettier:fix

Expand Down
2 changes: 1 addition & 1 deletion backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ app.use((_req, res, next) => {
next();
});
app.use(cookieParser());
app.use(express.json({ limit: '10mb' }));
app.use(express.json({ limit: "10mb" }));

const expressServer = createServer(app);

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/ProfilePageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function ProfilePageForm(props: ProfilePageFormProps) {
<button onClick={deleteUser} className="btn secondary">
Remove account
</button>

{showDeleteModal && (
<Modal
text={`Are you sure that you want to delete you account?`}
Expand All @@ -144,7 +144,6 @@ function ProfilePageForm(props: ProfilePageFormProps) {
))}
</ul>
</div>

</div>
</section>
);
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/components/RegisterBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function RegisterBox() {

const encodePicture = async (file: File): Promise<string> => {
return new Promise<string>((resolve) => {

const reader = new FileReader();
reader.onloadend = () => {
const base64 = reader.result as string;
Expand Down Expand Up @@ -106,7 +105,7 @@ function RegisterBox() {
throw new Error("Failed to fetch image");
}
} catch (error) {
throw new Error("Error fetching image: "+ error)
throw new Error("Error fetching image: " + error);
}
};

Expand Down Expand Up @@ -187,17 +186,21 @@ function RegisterBox() {
onChange={handleFileChange}
className="opacity-0 absolute top-0 left-0 w-full h-full cursor-pointer"
/>

</label>

{profilePictureBase64 && (
<>
<img
src={profilePictureBase64}
alt="Profile"
className="w-20 h-20 object-cover border border-gray-300 rounded-xl"
/>
<button className="btn secondary" onClick={()=>setProfilePictureBase64("")}>Clear</button>
<button
className="btn secondary"
onClick={() => setProfilePictureBase64("")}
>
Clear
</button>
</>
)}
</div>
Expand Down
54 changes: 27 additions & 27 deletions frontend/src/models/RegisterUserSchema.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import * as z from "zod"
import * as z from "zod";
import { FrontendUser } from "./User";

export const userSchema: z.ZodType<Partial<FrontendUser>> = z.object({
first_name: z
.string()
.min(2, "First name should be at least two characters long"),
last_name: z
.string()
.min(2, "Last name should be at least two characters long"),
country: z
.string()
.length(2, "Country code should be 2 characters long")
.toUpperCase(),
// profile_picture: z
// .any()
// .refine((obj) => (!obj ? "Profile picture is required" : ""))
// .refine((obj) => obj && obj.length <= 0, "Profile picture not provided")
// .transform((obj) => {
// if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) {
// return (obj as FileList)[0].name;
// } else {
// throw new Error("File is too big (>5 MB)");
// }
// }),
mail: z.string().email(),
password: z
.string()
.min(8, "Password should be at least eight characters long"),
});
first_name: z
.string()
.min(2, "First name should be at least two characters long"),
last_name: z
.string()
.min(2, "Last name should be at least two characters long"),
country: z
.string()
.length(2, "Country code should be 2 characters long")
.toUpperCase(),
// profile_picture: z
// .any()
// .refine((obj) => (!obj ? "Profile picture is required" : ""))
// .refine((obj) => obj && obj.length <= 0, "Profile picture not provided")
// .transform((obj) => {
// if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) {
// return (obj as FileList)[0].name;
// } else {
// throw new Error("File is too big (>5 MB)");
// }
// }),
mail: z.string().email(),
password: z
.string()
.min(8, "Password should be at least eight characters long"),
});

0 comments on commit f82e9aa

Please sign in to comment.