File tree Expand file tree Collapse file tree 5 files changed +24
-23
lines changed
src/components/statements Expand file tree Collapse file tree 5 files changed +24
-23
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ const ActionForm: React.FC<ActionFormProps> = ({
2626 } ;
2727
2828 return (
29- < div className = 'flex items-center bg-gray-50 p-2 rounded space-x-2 ' >
29+ < div className = 'flex items-center cursor-pointer hover: bg-gray-100 border border-dashed border-gray-300 p-1 rounded ' >
3030 < Input
3131 placeholder = 'Action text'
3232 value = { text }
@@ -43,15 +43,15 @@ const ActionForm: React.FC<ActionFormProps> = ({
4343 variant = 'ghost'
4444 size = 'sm'
4545 onClick = { handleSave }
46- className = 'text-green-500 hover:text-green-700'
46+ className = 'text-green-500 hover:text-green-700 m-0 '
4747 >
4848 < Save size = { 16 } />
4949 </ Button >
5050 < Button
5151 variant = 'ghost'
5252 size = 'sm'
5353 onClick = { onCancel }
54- className = 'text-gray-500 hover:text-gray-700'
54+ className = 'text-gray-500 hover:text-gray-700 m-0 '
5555 >
5656 < X size = { 16 } />
5757 </ Button >
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ const ActionPreview: React.FC<ActionPreviewProps> = ({
6565 } ;
6666
6767 return (
68- < div className = 'space-y-2' >
68+ < div className = 'space-y-2 ' >
6969 { actions . map ( ( action ) => {
7070 const isEditing = editingActionId === action . id ;
7171 if ( ! isEditing ) {
@@ -78,7 +78,7 @@ const ActionPreview: React.FC<ActionPreviewProps> = ({
7878 return (
7979 < div
8080 key = { action . id }
81- className = 'flex items-center justify-between bg-gray-50 p-2 rounded'
81+ className = 'flex items-center justify-between bg-white p-2 rounded border border-gray-200 shadow-sm '
8282 >
8383 < span className = 'flex-1' > { action . text } </ span >
8484 < span className = 'mx-4 text-sm text-gray-500' >
@@ -123,7 +123,7 @@ const ActionPreview: React.FC<ActionPreviewProps> = ({
123123 { /* Add new action: either show the "+ Add Action" row or the inline form */ }
124124 { ! isAddingNew ? (
125125 < div
126- className = 'flex items-center justify-between bg-gray-50 p-2 rounded cursor-pointer hover:bg -gray-100 '
126+ className = ' cursor-pointer hover: bg-gray-100 border border-dashed border -gray-300 p-2 rounded '
127127 onClick = { handleStartAdd }
128128 >
129129 < span className = 'flex-1' > + Add Action</ span >
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import { ChevronDown , ChevronUp } from 'lucide-react' ;
23
3- /**
4- * Props:
5- * - count: The total number of actions.
6- * - expanded?: whether the actions are expanded (to style differently).
7- *
8- * Behavior:
9- * - Displays a small pill with "no actions" if count is 0,
10- * or "1 action" if count is 1, or "X actions" otherwise.
11- */
124interface ActionsCounterProps {
135 count : number ;
146 expanded ?: boolean ;
@@ -20,19 +12,19 @@ const ActionsCounter: React.FC<ActionsCounterProps> = ({
2012} ) => {
2113 const baseClasses =
2214 'inline-flex items-center rounded-full px-3 py-1 text-sm transition-colors cursor-pointer' ;
23- const normalClasses = 'bg-gray-100 text-gray-600' ;
24- const expandedClasses = 'bg-blue-100 text-blue-600' ;
25-
15+ const backgroundClasses =
16+ count > 0 ? 'bg-brand-pink text-white' : 'bg-gray-100 text-gray-600' ;
2617 const displayText =
2718 count === 0
2819 ? 'no actions'
2920 : `${ count } ${ count === 1 ? 'action' : 'actions' } ` ;
3021
3122 return (
32- < span
33- className = { `${ baseClasses } ${ expanded ? expandedClasses : normalClasses } ` }
34- >
23+ < span className = { `${ baseClasses } ${ backgroundClasses } flex items-center` } >
3524 { displayText }
25+ < span className = 'ml-1' >
26+ { expanded ? < ChevronUp size = { 16 } /> : < ChevronDown size = { 16 } /> }
27+ </ span >
3628 </ span >
3729 ) ;
3830} ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
1212 DropdownMenuItem ,
1313} from '../ui/dropdown-menu' ;
1414import ActionsCounter from './ActionsCounter' ;
15- import ActionPreview from './ActionPreview ' ;
15+ import ActionPreview from './ActionLine ' ;
1616
1717export interface StatementItemProps {
1818 statement : Statement ;
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { useStatements } from '../../hooks/useStatements';
55import { ConfirmationDialog } from '../ui/confirmation-dialog' ;
66import type { Statement } from '../../../types/types' ;
77import preStatements from '../../../data/preStatements.json' ;
8- import StatementItem from './StatementItem' ;
8+ import nlp from 'compromise' ;
9+ import StatementItem from './StatementLine' ;
910import { updateStatement } from '../../api/statementsApi' ;
1011
1112const StatementList : React . FC < { username : string } > = ( { username } ) => {
@@ -43,9 +44,17 @@ const StatementList: React.FC<{ username: string }> = ({ username }) => {
4344 const subject = stmt . descriptor
4445 ? `${ username } 's ${ stmt . descriptor } `
4546 : username ;
47+ const presentTenseVerb = nlp ( stmt . verb )
48+ . verbs ( )
49+ . toPresentTense ( )
50+ . text ( )
51+ . toLowerCase ( ) ;
52+ const objectLower = stmt . object . toLowerCase ( ) ;
4653 return {
4754 ...stmt ,
4855 subject,
56+ verb : presentTenseVerb ,
57+ object : objectLower ,
4958 id :
5059 Date . now ( ) . toString ( ) + Math . random ( ) . toString ( 36 ) . substring ( 2 , 7 ) ,
5160 } ;
You can’t perform that action at this time.
0 commit comments