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
24 changes: 1 addition & 23 deletions src/app/(main)/analysis/[id]/[patentId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import type {
function renderArgumentForm(
analysis: InventiveStepAnalysisResponse,
logicKey: InventiveStepLogicKey,
contentIsPlaceholder: boolean,
onSave: (argumentId: number, content: InventiveStepArgumentContent) => Promise<void>
) {
const argument = getArgument(analysis, logicKey);
Expand All @@ -32,7 +31,6 @@ function renderArgumentForm(
case "NUMERICAL_LIMIT":
return (
<ArgumentFormA
recommended={!contentIsPlaceholder}
onSave={(effectItems) =>
onSave(argument.argumentId, {
effect_items: effectItems,
Expand All @@ -52,7 +50,6 @@ function renderArgumentForm(
<ArgumentFormB
initialBackgroundLimit={argument.content.background_limit ?? ""}
initialTeachingAway={argument.content.teaching_away ?? ""}
recommended={!contentIsPlaceholder}
onSave={(content) => onSave(argument.argumentId, content)}
/>
);
Expand All @@ -65,7 +62,6 @@ function renderArgumentForm(
<ArgumentFormC
initialTarget={target}
initialRebuttal={argument.content.rebuttal ?? ""}
recommended={!contentIsPlaceholder}
onSave={(content) => onSave(argument.argumentId, content)}
/>
);
Expand All @@ -82,7 +78,6 @@ function renderArgumentForm(
<ArgumentFormD
initialChangedComponent={changedComponent}
initialNonObviousness={argument.content.non_obviousness ?? ""}
recommended={!contentIsPlaceholder}
onSave={(content) => onSave(argument.argumentId, content)}
/>
);
Expand All @@ -103,9 +98,6 @@ export default function AnalysisReportPage({
isLoading,
selectedLogics,
aiRecommendedArgumentIds,
placeholderArgumentIds,
updatingLogics,
updateError,
toggleLogic,
saveArgumentContent,
reload,
Expand Down Expand Up @@ -172,18 +164,11 @@ export default function AnalysisReportPage({
getArgument(analysis, logic.key)?.argumentId ?? Number.NaN
)}
selected={selectedLogics.has(logic.key)}
disabled={updatingLogics.has(logic.key)}
onClick={() => toggleLogic(logic.key)}
/>
))}
</div>

{updateError && (
<p role="alert" className="text-body-13 text-error-default">
{updateError}
</p>
)}

<div className="mt-3 flex flex-col gap-3">
{selectedLogics.size === 0 ? (
<p className="py-20 text-center text-body-emphasis-17 text-caption-label">
Expand All @@ -193,14 +178,7 @@ export default function AnalysisReportPage({
INVENTIVE_STEP_LOGIC_TYPES.filter((logic) => selectedLogics.has(logic.key)).map(
(logic) => (
<div key={`${analysis.analysisId}-${logic.key}`}>
{renderArgumentForm(
analysis,
logic.key,
placeholderArgumentIds.has(
getArgument(analysis, logic.key)?.argumentId ?? Number.NaN
),
saveArgumentContent
)}
{renderArgumentForm(analysis, logic.key, saveArgumentContent)}
</div>
)
)
Expand Down
29 changes: 21 additions & 8 deletions src/app/(report)/myhistory/[id]/report/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ function getArgument(report: ReportDetailResponse, argumentType: ReportInventive
);
}

function hasContent(content: Record<string, unknown>) {
return Object.values(content).some((value) => {
if (Array.isArray(value)) return value.length > 0;
if (typeof value === "string") return value.trim().length > 0;
return value !== null && value !== undefined;
});
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

export default function ReportPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = use(params);
const { isAuthenticated, report, errorMessage, isLoading, reload } = useReport(id);
Expand Down Expand Up @@ -84,14 +92,15 @@ export default function ReportPage({ params }: { params: Promise<{ id: string }>
);
}

const numericalContent =
getArgument(report, "NUMERICAL_LIMIT")?.content ?? ({} as Record<string, unknown>);
const combinationContent =
getArgument(report, "COMBINATION_MOTIVATION")?.content ?? ({} as Record<string, unknown>);
const commonContent =
getArgument(report, "COMMON_TECHNIQUE")?.content ?? ({} as Record<string, unknown>);
const simpleContent =
getArgument(report, "SIMPLE_DESIGN")?.content ?? ({} as Record<string, unknown>);
const numericalArgument = getArgument(report, "NUMERICAL_LIMIT");
const combinationArgument = getArgument(report, "COMBINATION_MOTIVATION");
const commonArgument = getArgument(report, "COMMON_TECHNIQUE");
const simpleArgument = getArgument(report, "SIMPLE_DESIGN");

const numericalContent = numericalArgument?.content ?? ({} as Record<string, unknown>);
const combinationContent = combinationArgument?.content ?? ({} as Record<string, unknown>);
const commonContent = commonArgument?.content ?? ({} as Record<string, unknown>);
const simpleContent = simpleArgument?.content ?? ({} as Record<string, unknown>);
const effectItems = Array.isArray(numericalContent.effect_items)
? (numericalContent.effect_items as EffectItem[])
: [];
Expand Down Expand Up @@ -148,6 +157,10 @@ export default function ReportPage({ params }: { params: Promise<{ id: string }>
? toReference(report.inventiveStepAnalysis.secondaryPriorArt)
: null
}
showNumericalLimits={hasContent(numericalContent)}
showCombinationMotivation={hasContent(combinationContent)}
showCommonTechnique={hasContent(commonContent)}
showSimpleDesign={hasContent(simpleContent)}
numericalLimits={effectItems.map((effect, index) => ({
id: String(index + 1),
category: text(effect.metric),
Expand Down
8 changes: 8 additions & 0 deletions src/app/fonts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import localFont from "next/font/local";

export const pretendard = localFont({
src: "./fonts/PretendardVariable.woff2",
weight: "45 920",
variable: "--font-pretendard-loaded",
display: "swap",
});
Binary file added src/app/fonts/PretendardVariable.woff2
Binary file not shown.
3 changes: 1 addition & 2 deletions src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");
@import "tailwindcss";

:root {
Expand All @@ -9,7 +8,7 @@
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-pretendard: "Pretendard", sans-serif;
--font-pretendard: var(--font-pretendard-loaded), sans-serif;

/* =========================================
Text Color
Expand Down
3 changes: 2 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata } from "next";

import { jsonLd, siteConfig } from "@/constants/common/site";
import { Providers } from "@/app/providers";
import { pretendard } from "@/app/fonts";

import "./globals.css";

Expand Down Expand Up @@ -70,7 +71,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang={siteConfig.lang} className="h-full antialiased">
<html lang={siteConfig.lang} className={`h-full antialiased ${pretendard.variable}`}>
<body className="h-full overflow-hidden">
<script
type="application/ld+json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function ComparisionPatentBox({
<ReferenceChip variant="primary">주인용</ReferenceChip>

<div className="flex min-w-0 flex-col gap-1">
<p className="line-clamp-1 text-label-17 text-body-primary">
<p className="text-label-17 text-body-primary wrap-break-word">
{primaryReference.patentNumber} {primaryReference.title}
</p>

Expand All @@ -37,7 +37,7 @@ export default function ComparisionPatentBox({

{secondaryReference ? (
<div className="flex min-w-0 flex-col gap-1">
<p className="line-clamp-1 text-label-17 text-body-primary">
<p className="text-label-17 text-body-primary wrap-break-word">
{secondaryReference.patentNumber} {secondaryReference.title}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,13 @@ type InitialEffect = Omit<Effect, "id">;

export default function ArgumentFormA({
initialEffects,
recommended,
onSave,
}: {
initialEffects: InitialEffect[];
recommended: boolean;
onSave: (effectItems: NumericalLimitEffectItem[]) => Promise<void>;
}) {
const [effects, setEffects] = useState<Effect[]>(() =>
initialEffects.map((effect, index) =>
recommended
? { ...effect, id: `effect-${index}` }
: {
id: `effect-${index}`,
category: "",
unit: "",
priorArt: "",
invention: "",
improvement: "",
placeholders: {
category: effect.category,
unit: effect.unit,
priorArt: effect.priorArt,
invention: effect.invention,
improvement: effect.improvement,
},
}
)
initialEffects.map((effect, index) => ({ ...effect, id: `effect-${index}` }))
);
const [isEditing, setIsEditing] = useState(false);
const [isSaving, setIsSaving] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@ import { ArgumentTextArea } from "./ArgumentTextArea";
interface ArgumentFormBProps {
initialBackgroundLimit: string;
initialTeachingAway: string;
recommended: boolean;
onSave: (content: { background_limit: string; teaching_away: string }) => Promise<void>;
}

export default function ArgumentFormB({
initialBackgroundLimit,
initialTeachingAway,
recommended,
onSave,
}: ArgumentFormBProps) {
const [isEditing, setIsEditing] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const [saveError, setSaveError] = useState<string | null>(null);
const [backgroundLimitation, setBackgroundLimitation] = useState(
recommended ? initialBackgroundLimit : ""
);
const [teachingAway, setTeachingAway] = useState(recommended ? initialTeachingAway : "");
const [backgroundLimitation, setBackgroundLimitation] = useState(initialBackgroundLimit);
const [teachingAway, setTeachingAway] = useState(initialTeachingAway);

const handleToggleEdit = async () => {
if (!isEditing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ArgumentTextArea } from "./ArgumentTextArea";
interface ArgumentFormCProps {
initialTarget: string;
initialRebuttal: string;
recommended: boolean;
onSave: (content: {
target_label: string;
target_name: string;
Expand All @@ -18,14 +17,13 @@ interface ArgumentFormCProps {
export default function ArgumentFormC({
initialTarget,
initialRebuttal,
recommended,
onSave,
}: ArgumentFormCProps) {
const [isEditing, setIsEditing] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const [saveError, setSaveError] = useState<string | null>(null);
const [rejectionReason, setRejectionReason] = useState(recommended ? initialTarget : "");
const [counterArgument, setCounterArgument] = useState(recommended ? initialRebuttal : "");
const [rejectionReason, setRejectionReason] = useState(initialTarget);
const [counterArgument, setCounterArgument] = useState(initialRebuttal);

const handleToggleEdit = async () => {
if (!isEditing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ArgumentTextArea } from "./ArgumentTextArea";
interface ArgumentFormDProps {
initialChangedComponent: string;
initialNonObviousness: string;
recommended: boolean;
onSave: (content: {
changed_component_label: string;
changed_component_name: string;
Expand All @@ -18,16 +17,13 @@ interface ArgumentFormDProps {
export default function ArgumentFormD({
initialChangedComponent,
initialNonObviousness,
recommended,
onSave,
}: ArgumentFormDProps) {
const [isEditing, setIsEditing] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const [saveError, setSaveError] = useState<string | null>(null);
const [changedComponent, setChangedComponent] = useState(
recommended ? initialChangedComponent : ""
);
const [counterArgument, setCounterArgument] = useState(recommended ? initialNonObviousness : "");
const [changedComponent, setChangedComponent] = useState(initialChangedComponent);
const [counterArgument, setCounterArgument] = useState(initialNonObviousness);

const handleToggleEdit = async () => {
if (!isEditing) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/myhistory/Tab.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"use client";

type TabValue = "전체" | "대기 중" | "완료";
type TabValue = "전체" | "분석 중" | "완료";

interface TabProps {
active: TabValue;
counts: { 전체: number; "대기 중": number; 완료: number };
counts: { 전체: number; "분석 중": number; 완료: number };
onChange: (tab: TabValue) => void;
}

const TABS: TabValue[] = ["전체", "대기 중", "완료"];
const TABS: TabValue[] = ["전체", "분석 중", "완료"];

export function Tab({ active, counts, onChange }: TabProps) {
return (
Expand Down
22 changes: 18 additions & 4 deletions src/components/report/InventiveStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type InventiveStepProps = {
satisfied: boolean;
primaryReference: ComparisonReference;
secondaryReference: ComparisonReference | null;
showNumericalLimits: boolean;
showCombinationMotivation: boolean;
showCommonTechnique: boolean;
showSimpleDesign: boolean;
numericalLimits: Effect[];
backgroundLimit: string;
motivationAbsence: string;
Expand All @@ -25,6 +29,10 @@ export default function InventiveStep({
satisfied,
primaryReference,
secondaryReference,
showNumericalLimits,
showCombinationMotivation,
showCommonTechnique,
showSimpleDesign,
numericalLimits,
backgroundLimit,
motivationAbsence,
Expand All @@ -49,13 +57,19 @@ export default function InventiveStep({
secondaryReference={secondaryReference}
/>

<ArgumentA effects={numericalLimits} />
{showNumericalLimits && <ArgumentA effects={numericalLimits} />}

<ArgumentB backgroundLimit={backgroundLimit} motivationAbsence={motivationAbsence} />
{showCombinationMotivation && (
<ArgumentB backgroundLimit={backgroundLimit} motivationAbsence={motivationAbsence} />
)}

<ArgumentC rejectionReason={rejectionReason} rebuttalLogic={rebuttalLogic} />
{showCommonTechnique && (
<ArgumentC rejectionReason={rejectionReason} rebuttalLogic={rebuttalLogic} />
)}

<ArgumentD changedComponent={changedComponent} nonObviousnessLogic={nonObviousnessLogic} />
{showSimpleDesign && (
<ArgumentD changedComponent={changedComponent} nonObviousnessLogic={nonObviousnessLogic} />
)}
</section>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function ComparisionPatentBox({
<ReferenceChip variant="primary">주인용</ReferenceChip>

<div className="flex min-w-0 flex-col gap-1">
<p className="line-clamp-1 text-label-15 text-body-primary">
<p className="text-label-15 text-body-primary wrap-break-word">
{primaryReference.patentNumber} {primaryReference.title}
</p>

Expand All @@ -40,7 +40,7 @@ export default function ComparisionPatentBox({
<ReferenceChip variant="secondary">부인용</ReferenceChip>

<div className="flex min-w-0 flex-col gap-1">
<p className="line-clamp-1 text-label-15 text-body-primary">
<p className="text-label-15 text-body-primary wrap-break-word">
{secondaryReference.patentNumber} {secondaryReference.title}
</p>

Expand Down
2 changes: 1 addition & 1 deletion src/components/report/NoveltyComparision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function NoveltyComparison({
<p className="text-label-emphasis-15 text-title-secondary">{item.title}</p>
</div>

<span className="text-label-13 text-primary-sub">{item.diff}</span>
<span className="text-label-13 leading-5 text-primary-sub">{item.diff}</span>
</div>
))}
</div>
Expand Down
Loading
Loading