mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Refactor codebase, format
This commit is contained in:
@@ -9,9 +9,7 @@ import UserContext from '@/contexts/userContext';
|
||||
import sendCheckIfUserLikesBeerPostRequest from '@/requests/sendCheckIfUserLikesBeerPostRequest';
|
||||
import sendLikeRequest from '../../requests/sendLikeRequest';
|
||||
|
||||
const BeerInfoHeader: FC<{ beerPost: BeerPostQueryResult }> = ({
|
||||
beerPost,
|
||||
}) => {
|
||||
const BeerInfoHeader: FC<{ beerPost: BeerPostQueryResult }> = ({ beerPost }) => {
|
||||
const createdAtDate = new Date(beerPost.createdAt);
|
||||
const [timeDistance, setTimeDistance] = useState('');
|
||||
const { user } = useContext(UserContext);
|
||||
@@ -36,9 +34,7 @@ const BeerInfoHeader: FC<{ beerPost: BeerPostQueryResult }> = ({
|
||||
}, [user, beerPost.id]);
|
||||
|
||||
useEffect(() => {
|
||||
setTimeDistance(
|
||||
formatDistanceStrict(new Date(beerPost.createdAt), new Date()),
|
||||
);
|
||||
setTimeDistance(formatDistanceStrict(new Date(beerPost.createdAt), new Date()));
|
||||
}, [beerPost.createdAt]);
|
||||
|
||||
const handleLike = async () => {
|
||||
@@ -66,10 +62,7 @@ const BeerInfoHeader: FC<{ beerPost: BeerPostQueryResult }> = ({
|
||||
|
||||
<h3 className="italic">
|
||||
posted by{' '}
|
||||
<Link
|
||||
href={`/users/${beerPost.postedBy.id}`}
|
||||
className="link-hover link"
|
||||
>
|
||||
<Link href={`/users/${beerPost.postedBy.id}`} className="link-hover link">
|
||||
{beerPost.postedBy.username}{' '}
|
||||
</Link>
|
||||
<span
|
||||
@@ -92,9 +85,7 @@ const BeerInfoHeader: FC<{ beerPost: BeerPostQueryResult }> = ({
|
||||
</Link>
|
||||
</div>
|
||||
<div>
|
||||
<span className="mr-4 text-lg font-medium">
|
||||
{beerPost.abv}% ABV
|
||||
</span>
|
||||
<span className="mr-4 text-lg font-medium">{beerPost.abv}% ABV</span>
|
||||
<span className="text-lg font-medium">{beerPost.ibu} IBU</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,17 +14,10 @@ const BeerRecommendations: FunctionComponent<BeerRecommendationsProps> = ({
|
||||
{beerRecommendations.map((beerPost) => (
|
||||
<div key={beerPost.id} className="w-full">
|
||||
<div>
|
||||
<Link
|
||||
className="link-hover"
|
||||
href={`/beers/${beerPost.id}`}
|
||||
scroll={false}
|
||||
>
|
||||
<Link className="link-hover" href={`/beers/${beerPost.id}`} scroll={false}>
|
||||
<h2 className="text-2xl font-bold">{beerPost.name}</h2>
|
||||
</Link>
|
||||
<Link
|
||||
href={`/breweries/${beerPost.brewery.id}`}
|
||||
className="link-hover"
|
||||
>
|
||||
<Link href={`/breweries/${beerPost.brewery.id}`} className="link-hover">
|
||||
<p className="text-lg font-semibold">{beerPost.brewery.name}</p>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import sendLoginUserRequest from '@/requests/sendLoginUserRequest';
|
||||
import LoginValidationSchema from '@/services/user/schema/LoginValidationSchema';
|
||||
import LoginValidationSchema from '@/services/User/schema/LoginValidationSchema';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useForm, SubmitHandler } from 'react-hook-form';
|
||||
@@ -66,7 +66,7 @@ const LoginForm = () => {
|
||||
</div>
|
||||
|
||||
<div className="w-full">
|
||||
<button type="submit" className="btn-primary btn w-full">
|
||||
<button type="submit" className="btn btn-primary w-full">
|
||||
Login
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,7 @@ const Navbar = () => {
|
||||
return (
|
||||
<nav className="navbar bg-primary">
|
||||
<div className="flex-1">
|
||||
<Link className="btn-ghost btn text-3xl normal-case" href="/">
|
||||
<Link className="btn btn-ghost text-3xl normal-case" href="/">
|
||||
<span className="cursor-pointer text-xl font-bold">The Biergarten App</span>
|
||||
</Link>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@ const Navbar = () => {
|
||||
</div>
|
||||
<div className="flex-none lg:hidden">
|
||||
<div className="dropdown-end dropdown">
|
||||
<label tabIndex={0} className="btn-ghost btn-circle btn">
|
||||
<label tabIndex={0} className="btn btn-ghost btn-circle">
|
||||
<span className="w-10 rounded-full">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
||||
@@ -7,7 +7,7 @@ interface FormButtonProps {
|
||||
|
||||
const Button: FunctionComponent<FormButtonProps> = ({ children, type }) => (
|
||||
// eslint-disable-next-line react/button-has-type
|
||||
<button type={type} className="btn-primary btn mt-4 w-full rounded-xl">
|
||||
<button type={type} className="btn btn-primary mt-4 w-full rounded-xl">
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user