@@ -15,6 +15,7 @@ import { VisualizationModalProps, TaskListItem } from '../types';
1515import Task from '../../Task/Task' ;
1616import { Task as TaskType } from '../../../services/taskService' ;
1717import CalendarGrid from '../../Calendar/CalendarGrid' ;
18+ import Category from '../../Category/Category' ;
1819import dayjs from 'dayjs' ;
1920
2021/**
@@ -239,63 +240,26 @@ const VisualizationModal: React.FC<VisualizationModalProps> = ({
239240 }
240241
241242 if ( isCategoryList ) {
242- // Usa imageUrl solo se è un URL valido (inizia con http/https/file://)
243- // Altrimenti lascia undefined per usare l'icona predefinita
244- const validImageUrl = item . imageUrl || item . icon ;
245- const isValidUrl = validImageUrl && (
246- validImageUrl . startsWith ( 'http://' ) ||
247- validImageUrl . startsWith ( 'https://' ) ||
248- validImageUrl . startsWith ( 'file://' )
249- ) ;
250-
251243 return (
252- < TouchableOpacity
244+ < Category
253245 key = { index }
254- style = { styles . categoryCard }
255- activeOpacity = { 0.7 }
256- onPress = { ( ) => {
257- console . log ( '[VisualizationModal] Category pressed:' , item . name ) ;
258- console . log ( '[VisualizationModal] onCategoryPress available:' , ! ! onCategoryPress ) ;
259- if ( onCategoryPress ) {
260- onCategoryPress ( item ) ;
261- } else {
262- console . warn ( '[VisualizationModal] onCategoryPress is not defined!' ) ;
263- }
246+ title = { item . name }
247+ description = { item . description }
248+ imageUrl = { item . imageUrl || item . icon }
249+ categoryId = { item . id || item . category_id }
250+ isShared = { item . isShared || item . is_shared }
251+ isOwned = { item . isOwned !== undefined ? item . isOwned : true }
252+ ownerName = { item . ownerName || item . owner_name }
253+ permissionLevel = { item . permissionLevel || item . permission_level || "READ_WRITE" }
254+ onDelete = { ( ) => {
255+ // Refresh modal data if needed
256+ console . log ( '[VisualizationModal] Category deleted:' , item . name ) ;
264257 } }
265- >
266- < View style = { styles . categoryIconContainer } >
267- { isValidUrl ? (
268- < Image source = { { uri : validImageUrl } } style = { styles . categoryImage } />
269- ) : (
270- < Ionicons name = "folder" size = { 32 } color = "#007AFF" />
271- ) }
272- </ View >
273- < View style = { styles . categoryTextContainer } >
274- < Text style = { styles . categoryTitle } numberOfLines = { 1 } >
275- { item . name }
276- </ Text >
277- { item . description && (
278- < Text style = { styles . categoryDescription } numberOfLines = { 2 } >
279- { item . description }
280- </ Text >
281- ) }
282- < View style = { styles . categoryMetaContainer } >
283- < View style = { styles . categoryTaskCount } >
284- < Ionicons name = "list-outline" size = { 14 } color = "#666666" />
285- < Text style = { styles . categoryTaskCountText } >
286- { item . taskCount || item . task_count || 0 } task
287- </ Text >
288- </ View >
289- { item . isShared && (
290- < View style = { styles . categorySharedBadge } >
291- < Ionicons name = "people-outline" size = { 14 } color = "#007AFF" />
292- < Text style = { styles . categorySharedText } > Condiviso</ Text >
293- </ View >
294- ) }
295- </ View >
296- </ View >
297- < Ionicons name = "chevron-forward" size = { 20 } color = "#C7C7CC" />
298- </ TouchableOpacity >
258+ onEdit = { ( ) => {
259+ // Refresh modal data if needed
260+ console . log ( '[VisualizationModal] Category edited:' , item . name ) ;
261+ } }
262+ />
299263 ) ;
300264 }
301265
@@ -815,85 +779,6 @@ const styles = StyleSheet.create({
815779 color : '#FFFFFF' ,
816780 fontFamily : 'System' ,
817781 } ,
818- // Stili per le category card personalizzate nella chat
819- categoryCard : {
820- flexDirection : 'row' ,
821- alignItems : 'center' ,
822- backgroundColor : '#FFFFFF' ,
823- borderRadius : 12 ,
824- paddingHorizontal : 16 ,
825- paddingVertical : 14 ,
826- marginBottom : 12 ,
827- marginHorizontal : 16 ,
828- shadowColor : '#000' ,
829- shadowOffset : { width : 0 , height : 1 } ,
830- shadowOpacity : 0.05 ,
831- shadowRadius : 3 ,
832- elevation : 1 ,
833- borderWidth : 1.5 ,
834- borderColor : '#E1E5E9' ,
835- } ,
836- categoryIconContainer : {
837- width : 48 ,
838- height : 48 ,
839- borderRadius : 24 ,
840- backgroundColor : '#E5F1FF' ,
841- alignItems : 'center' ,
842- justifyContent : 'center' ,
843- marginRight : 12 ,
844- overflow : 'hidden' ,
845- } ,
846- categoryImage : {
847- width : 48 ,
848- height : 48 ,
849- borderRadius : 24 ,
850- } ,
851- categoryTextContainer : {
852- flex : 1 ,
853- } ,
854- categoryTitle : {
855- fontSize : 17 ,
856- fontWeight : '600' ,
857- color : '#000000' ,
858- marginBottom : 4 ,
859- fontFamily : 'System' ,
860- } ,
861- categoryDescription : {
862- fontSize : 14 ,
863- color : '#666666' ,
864- marginBottom : 6 ,
865- fontFamily : 'System' ,
866- } ,
867- categoryMetaContainer : {
868- flexDirection : 'row' ,
869- alignItems : 'center' ,
870- gap : 12 ,
871- } ,
872- categoryTaskCount : {
873- flexDirection : 'row' ,
874- alignItems : 'center' ,
875- gap : 4 ,
876- } ,
877- categoryTaskCountText : {
878- fontSize : 13 ,
879- color : '#666666' ,
880- fontFamily : 'System' ,
881- } ,
882- categorySharedBadge : {
883- flexDirection : 'row' ,
884- alignItems : 'center' ,
885- gap : 4 ,
886- backgroundColor : '#E5F1FF' ,
887- paddingHorizontal : 8 ,
888- paddingVertical : 2 ,
889- borderRadius : 8 ,
890- } ,
891- categorySharedText : {
892- fontSize : 12 ,
893- color : '#007AFF' ,
894- fontWeight : '600' ,
895- fontFamily : 'System' ,
896- } ,
897782} ) ;
898783
899784export default VisualizationModal ;
0 commit comments