Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
fix: Post stage fixv2.0 (#105)
Browse files Browse the repository at this point in the history
* style: added shadow and border

* style: change button position in setting page

* test: updated seed

* fix: removed Messages tab

* feat: added update password to normal user

* style: minor fix

* feat(style): tweet now have a bit of shadows

---------

Co-authored-by: Falcon <falfzz28@gmail.com>
Co-authored-by: Nathan <79507956+CUexter@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 14, 2023
1 parent 56f0ad5 commit 0f143ac
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
echo TEST_PW=\"${{ secrets.TEST_PW }}\"
echo S3_UPLOAD_KEY=\"${{ secrets.S3_UPLOAD_KEY }}\"
echo S3_UPLOAD_SECRET=\"${{ secrets.S3_UPLOAD_SECRET }}\"
echo S3_UPLOAD_BUCKET=\"${{ secrets.S3_UPLOAD_BUCKET }}\"
echo S3_UPLOAD_REGION=\"${{ secrets.S3_UPLOAD_REGION }}\"
echo S3_UPLOAD_BUCKET=\"${{ vars.S3_UPLOAD_BUCKET }}\"
echo S3_UPLOAD_REGION=\"${{ vars.S3_UPLOAD_REGION }}\"
} >> ./.env
- name: Generate DB schema
Expand Down
95 changes: 94 additions & 1 deletion prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,44 @@ async function main() {
update: {},
});

// hashed password: "12345678"
await prisma.user.upsert({
where: {
id: "uid0",
},
create: {
id: "uid0",
name: "ElonMusk",
email: "elonmusk@gmail.com",
password: "$2a$10$EGwRCF5pvWN5PakWjbhYTOVhtrWp/wOwb7i3qOhIIAICtm1Dhzftq",
emailVerified: new Date(2023, 3, 2),
display_name: "Elon Musk",
tag_name: "realelonmusk",
profile_desc: "I am real Elon Musk",
image:
"https://pbs.twimg.com/profile_images/1590968738358079488/IY9Gx6Ok_400x400.jpg",
is_admin: true,
Tweet: {
create: [
{
id: "t0",
is_public: true,
published_at: new Date(2023, 4, 1),
TweetText: {
create: [
{
id: "tt0",
tweet_text: "Welcome to my world",
},
],
},
},
],
},
},
update: {},
});

await prisma.user.upsert({
where: {
id: "uid1",
Expand All @@ -35,7 +73,9 @@ async function main() {
display_name: "Alice Li",
tag_name: "alice2733",
profile_desc: "something something",
is_admin: true,
is_admin: false,
image:
"https://www.looper.com/img/gallery/things-only-adults-notice-in-alice-in-wonderland/intro-1602781527.jpg",
Tweet: {
create: [
{
Expand Down Expand Up @@ -86,6 +126,8 @@ async function main() {
tag_name: "bobby211",
profile_desc: "bobbbbbbbb",
is_admin: false,
image:
"https://www.nickiswift.com/img/gallery/heres-why-you-dont-hear-from-b-o-b-anymore/intro-1603365517.jpg",
Tweet: {
create: [
{
Expand All @@ -107,6 +149,57 @@ async function main() {
update: {},
});

// hashed password: "12345678"
await prisma.user.upsert({
where: {
id: "uid3",
},
create: {
id: "uid3",
name: "Chris",
email: "chris@gmail.com",
password: "$2a$10$EGwRCF5pvWN5PakWjbhYTOVhtrWp/wOwb7i3qOhIIAICtm1Dhzftq",
emailVerified: new Date(2023, 3, 2),
display_name: "Chris",
tag_name: "chris123",
profile_desc: "YO HI!",
image:
"https://resizing.flixster.com/dpI-g-9p6W_Nlhc2f0-cwEmM00Q=/218x280/v2/https://flxt.tmsimg.com/assets/249381_v9_bb.jpg",
is_admin: false,
Tweet: {
create: [
{
id: "t3",
is_public: true,
published_at: new Date(2023, 3, 28),
TweetText: {
create: [
{
id: "tt3",
tweet_text: "First tweet!",
},
],
},
},
{
id: "t4",
is_public: true,
published_at: new Date(2023, 4, 14),
TweetText: {
create: [
{
id: "tt4",
tweet_text: "Last tweet!",
},
],
},
},
],
},
},
update: {},
});

// bob likes alice's tweet
await prisma.like.upsert({
where: {
Expand Down
8 changes: 0 additions & 8 deletions src/components/layout/header/AccountHeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { api } from "@/utils/api";
import { Avatar, Menu } from "@mantine/core";
import {
IconLogout,
IconMessageCircle,
IconSettings,
IconUserCircle,
IconUserShield,
Expand Down Expand Up @@ -37,13 +36,6 @@ const AccountHeaderMenu = () => {
>
Settings
</Menu.Item>
<Menu.Item
icon={<IconMessageCircle size={14} />}
component={Link}
href="/chat"
>
Messages
</Menu.Item>
<Menu.Item
icon={<IconUserCircle size={14} />}
component={Link}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tweets/Tweet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const Tweet = ({ tweetID, tweetData }: TweetProp) => {
return (
<>
<div className="mx-auto w-3/4">
<Card withBorder>
<Card withBorder shadow="md">
{attachements.length > 0 && (
<Card.Section>{attachementDisplay}</Card.Section>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tweets/TweetComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const TweetComposer = ({
};

return (
<Card className="pt-2">
<Card className="pt-2" shadow="sm" withBorder>
<form onSubmit={form.onSubmit(handleSubmit)}>
<Textarea
variant="unstyled"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/auth/new-user.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ const NewUserWelcome = () => {
</Grid>
</Container>

<Group position="right" mt="md">
<Button variant="light" type="submit">
<Group position="center" mt="md">
<Button type="submit" variant="outline" color="blue">
Submit
</Button>
</Group>
Expand Down
21 changes: 20 additions & 1 deletion src/pages/settings.page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import UpdatePw from "@/components/crud/UpdatePw";
import { api } from "@/utils/api";
import {
Avatar,
Expand All @@ -10,6 +11,7 @@ import {
Grid,
Group,
Image,
Modal,
TextInput,
Textarea,
Title,
Expand All @@ -25,6 +27,7 @@ import { useEffect, useState } from "react";
const ProfileSettings = () => {
const { uploadToS3 } = usePresignedUpload();
const [qTimes, setQTimes] = useState(0);
const [isUpdatePw, setIsUpdatePw] = useState(false);
const isEmailIfPresent = (value: string | undefined | null) => {
if (!value) {
return null;
Expand Down Expand Up @@ -211,12 +214,28 @@ const ProfileSettings = () => {
</Grid.Col>
</Grid>
</Container>
<Group position="right" mt="md">
<Group position="center" mt="md">
<Button
variant="outline"
color="red "
onClick={() => setIsUpdatePw(true)}
>
Update Password
</Button>
<Button type="submit" variant="outline" color="blue">
Submit
</Button>
</Group>
</form>
<Modal
opened={isUpdatePw}
onClose={() => setIsUpdatePw(false)}
title="Update Password"
size="30%"
centered
>
<UpdatePw id={session?.user.id} />
</Modal>
</>
);
};
Expand Down
6 changes: 6 additions & 0 deletions udb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/zsh

pnpm prisma generate
pnpm prisma db push
pnpm run db-seed
pnpm prisma studio

1 comment on commit 0f143ac

@vercel
Copy link

@vercel vercel bot commented on 0f143ac Apr 14, 2023

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:

tweet – ./

tweet-cuexter.vercel.app
tweet-rose.vercel.app
tweet-git-main-cuexter.vercel.app

Please sign in to comment.