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

fix: update card ui, slope camera click range and toast #45

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/features/slop/ui/slop-camera.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { useEffect, useRef } from 'react';
import { createPortal } from 'react-dom';
import { toast } from 'sonner';
import type { Position, Webcam } from '@/entities/slop/model/model';
import ArrowRightIcon from '@/shared/icons/arrow-right';
import NeutralFace from '@/shared/icons/neutral-face';
import { cn } from '@/shared/lib';
import postAppMessage from '@/shared/lib/postAppMessage';
import CameraButton from '@/shared/ui/cam-button';
Expand Down Expand Up @@ -44,7 +46,13 @@ const SlopCamera = ({
setOpenCamera();

if (!src) {
postAppMessage('선택한 웹캠은 아직 준비중 이에요');
postAppMessage('선택한 웹캠은 아직 준비중 이에요', (message) =>
toast(
<>
<NeutralFace /> {message}
</>
)
);
}
};

Expand All @@ -68,10 +76,8 @@ const SlopCamera = ({
}
isOpen={isOpen}
>
<div className={cn('flex items-center')}>
<p className={cn('body3-medium')} onClick={openVideo}>
{name}
</p>
<div className={cn('flex cursor-pointer items-center')} onClick={openVideo}>
<p className={cn('body3-medium')}>{name}</p>
<ArrowRightIcon />
</div>
</Tooltip>
Expand Down
6 changes: 2 additions & 4 deletions src/shared/lib/postAppMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ declare global {
}
}

const postAppMessage = (message: string) => {
const postAppMessage = (message: string, showToast: (message: string) => void) => {
const userAgent = navigator.userAgent.toLowerCase();
const android = userAgent.match(/android/i);
const iphone = userAgent.match(/iphone/i);

if (android !== null) {
console.log("Android");
return window.Android.showToast(message);
} else if (iphone !== null) {
console.log("iOS");
if (window.webkit.messageHandlers.weski) {
window.webkit.messageHandlers.weski.postMessage({ method: "showToast", message: message });
} else {
console.error("Weski bridge is not available.");
}
} else {
return window.opener.postMessage(message);
return showToast(message);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
const Card = ({ className, children, ...props }: CardProps) => (
<div
className={cn(
'backdrop-blur-px rounded-[15px] border border-white/15 bg-gradient-to-br from-white/15 to-white/30 shadow-[2px_10px_29px_0px_rgba(47,49,65,0.02)]',
'backdrop-blur-px rounded-[15px] border border-white/30 bg-gradient-to-br from-white/90 to-white/30 shadow-[2px_10px_29px_0px_rgba(47,49,65,0.02)]',
className
)}
{...props}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/discovery/ui/discovery-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const DiscoveryCard = ({ resortId, name, openSlopes, currentWeather, weeklyWeath
<Card
className={cn(
'box-border flex cursor-pointer flex-col gap-[15px] pb-4 pt-[34px] md:pb-[26px] md:pt-10',
'transition-all hover:scale-[1.02] hover:border-2 hover:border-main-1/30 hover:pb-[15px] hover:pt-[33px] hover:md:pb-[25px] hover:md:pt-[39px]'
'transition-all hover:scale-[1.02] hover:border-2 hover:border-main-1/60 hover:pb-[15px] hover:pt-[33px] hover:md:pb-[25px] hover:md:pt-[39px]'
)}
onClick={() => router.push(`/${resortId}`)}
>
Expand Down
Loading