Skip to content
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
23 changes: 19 additions & 4 deletions src/app/(app)/trips/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default function TripsPage() {
const { resetDraft } = useTripDraft();

const [schedules, setSchedules] = useState<ScheduleSummary[]>([]);
const [showAllSchedules, setShowAllSchedules] = useState(false);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [now, setNow] = useState(() => new Date());
Expand Down Expand Up @@ -202,6 +203,8 @@ export default function TripsPage() {
const upcoming = sorted.find((s) => diffDays(today, parseDate(s.endDate)) >= 0);
return upcoming ?? sorted[sorted.length - 1];
}, [sorted, today]);
const visibleSchedules = showAllSchedules ? sorted : sorted.slice(0, 3);
const canToggleSchedules = sorted.length > 3;

return (
<div className={`${pageFont.className} flex w-full min-w-0 flex-1 flex-col overflow-x-clip bg-[#F8FBFF] text-[#14233F]`}>
Expand Down Expand Up @@ -326,16 +329,28 @@ export default function TripsPage() {
<h2 className="text-[clamp(17px,4vw,20px)] font-extrabold tracking-tight">
모든 일정 <span className="text-[#2E7DF2]">{sorted.length}</span>
</h2>
<span className="flex items-center gap-1 text-[clamp(12px,2.8vw,14px)] font-medium text-[#64758E]">
전체 보기 <ChevronRight className="size-[clamp(16px,3.75vw,19px)]" strokeWidth={1.9} aria-hidden />
</span>
{canToggleSchedules && (
<button
type="button"
onClick={() => setShowAllSchedules((value) => !value)}
className="flex items-center gap-1 text-[clamp(12px,2.8vw,14px)] font-medium text-[#64758E] transition-colors hover:text-[#2E7DF2]"
aria-expanded={showAllSchedules}
>
{showAllSchedules ? "접기" : "전체 보기"}
<ChevronRight
className={`size-[clamp(16px,3.75vw,19px)] transition-transform ${showAllSchedules ? "-rotate-90" : ""}`}
strokeWidth={1.9}
aria-hidden
/>
</button>
)}
</div>

{sorted.length === 0 ? (
<p className="py-12 text-center text-sm text-zinc-400">아직 만든 일정이 없어요</p>
) : (
<ul className="mt-3 flex flex-col gap-3">
{sorted.map((t) => (
{visibleSchedules.map((t) => (
<li key={t.id}>
<Link
href={`/trips/${t.id}`}
Expand Down
30 changes: 25 additions & 5 deletions src/components/trip/TransitPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ function transitLabel(transit: ScheduleTransit) {
return `${route} · ${transit.totalMinutes}분`;
}

function hasPublicTransitSegment(transit: ScheduleTransit) {
return transit.segments.some((segment) => segment.mode !== "WALK");
}

function transitSummaryModeLabel(transit: ScheduleTransit) {
if (hasPublicTransitSegment(transit)) return "대중교통";
const mode = transit.segments[0]?.mode ?? "WALK";
return modeInfo(mode).label;
}

function providerDisplayLabel(provider: string | null) {
const key = provider?.toUpperCase();
if (!key || key === "FAKE" || key === "UNKNOWN") return null;
if (key === "ODSAY") return "대중교통 경로";
if (key === "TMAP") return "도보 경로";
if (key === "INTERNAL_WALK") return null;
return null;
}

function SegmentDetail({ segment }: { segment: ScheduleTransitSegment }) {
const mode = modeInfo(segment.mode);
const lineName = present(segment.lineName);
Expand Down Expand Up @@ -154,7 +173,8 @@ export default function TransitPanel({
const originName = present(transit.originName);
const destinationName = present(transit.destinationName);
const warnings = transit.warnings.filter((warning) => present(warning));
const hasPublicRide = transit.segments.some((segment) => segment.mode !== "WALK");
const hasPublicRide = hasPublicTransitSegment(transit);
const providerLabel = providerDisplayLabel(provider);
const statusLabel = !hasRouteGeometry
? "경로 상세 없음"
: estimated
Expand All @@ -181,7 +201,7 @@ export default function TransitPanel({
const hasExpandableDetails = usesSpontaneousRoadGuidance
? roadGuidanceLines.length > 0
: transit.segments.length > 0;
const primaryMode = roadSegment?.mode ?? transit.segments[0]?.mode ?? "WALK";
const primaryMode = hasPublicRide ? "TRANSIT" : roadSegment?.mode ?? transit.segments[0]?.mode ?? "WALK";
const PrimaryModeIcon = primaryMode === "WALK" ? Footprints : Route;

if (appearance === "spontaneous-result") {
Expand Down Expand Up @@ -219,9 +239,9 @@ export default function TransitPanel({
</span>
<span className="min-w-0 flex-1">
<span className="font-bold text-[#30435f]">
{modeInfo(primaryMode).label} {transit.totalMinutes}분
{transitSummaryModeLabel(transit)} {transit.totalMinutes}분
</span>
{provider && <span className="ml-2 text-[#7f8da3]">{provider}</span>}
{providerLabel && <span className="ml-2 text-[#7f8da3]">{providerLabel}</span>}
</span>
{hasExpandableDetails && (
<span className="flex shrink-0 items-center gap-1 font-semibold text-[#42536d]">
Expand Down Expand Up @@ -302,7 +322,7 @@ export default function TransitPanel({
{transit.walkMinutes > 0 && <span>도보 {transit.walkMinutes}분</span>}
{hasPublicRide && <span>환승 {transit.transferCount}회</span>}
{transit.fareAmount != null && <span>약 {transit.fareAmount.toLocaleString()}원</span>}
{provider && <span>{provider}</span>}
{providerLabel && <span>{providerLabel}</span>}
</div>

{usesSpontaneousRoadGuidance ? (
Expand Down
Loading