1- use std:: ops:: Deref ;
2-
31use leptos:: * ;
2+ use leptos_router:: A ;
43use serde_json:: { Map , Value } ;
54use superposition_types:: database:: models:: cac:: Context ;
65
76use crate :: {
87 components:: {
98 condition_pills:: Condition as ConditionComponent ,
10- datetime:: Datetime ,
11- description:: InfoDescription ,
129 table:: { Table , types:: Column } ,
13- tooltip:: Tooltip ,
1410 } ,
1511 logic:: Conditions ,
1612} ;
@@ -42,7 +38,11 @@ fn ContextOptions(
4238) -> impl IntoView {
4339 view ! {
4440 <div class="w-fit dropdown dropdown-left" >
45- <label tabindex="0" class="btn btn-sm text-xs m-1 w-full" >
41+ <label
42+ tabindex="0"
43+ class="btn btn-sm text-xs m-1 w-full"
44+ on: click=|ev: web_sys:: MouseEvent | ev. stop_propagation( )
45+ >
4646 <i class="ri-more-2-fill" />
4747 </label>
4848 <ul
@@ -86,15 +86,14 @@ pub fn ContextCard(
8686 context : Context ,
8787 overrides : Map < String , Value > ,
8888 #[ prop( default = true ) ] show_actions : bool ,
89+ #[ prop( into) ] href : String ,
8990 #[ prop( into) ] handle_create_experiment : Callback < String , ( ) > ,
9091 #[ prop( into) ] handle_delete_experiment : Callback < String , ( ) > ,
9192 #[ prop( into) ] handle_edit : Callback < String , ( ) > ,
9293 #[ prop( into) ] handle_clone : Callback < String , ( ) > ,
9394 #[ prop( into) ] handle_delete : Callback < String , ( ) > ,
9495) -> impl IntoView {
9596 let conditions = Conditions :: from_iter ( context. value . clone ( ) . into_inner ( ) ) ;
96- let description = context. description . clone ( ) ;
97- let change_reason = context. change_reason . clone ( ) ;
9897
9998 let override_table_rows = overrides
10099 . clone ( )
@@ -108,6 +107,7 @@ pub fn ContextCard(
108107 . collect :: < Vec < Map < String , Value > > > ( ) ;
109108
110109 let context = store_value ( context) ;
110+ let href = store_value ( href) ;
111111
112112 let table_columns = vec ! [
113113 Column :: default_no_collapse( "KEY" . to_string( ) ) ,
@@ -118,47 +118,18 @@ pub fn ContextCard(
118118 show_actions && !conditions. 0 . iter ( ) . any ( |c| c. variable == "variantIds" ) ;
119119
120120 view ! {
121- <div class="rounded-lg shadow bg-base-100 p-6 flex flex-col gap-4" >
121+ <div class="block rounded-lg shadow bg-base-100 p-6 flex flex-col gap-4" >
122122 <div class="flex justify-between" >
123123 <div class="flex gap-4 items-center" >
124124 <h3 class="card-title text-base timeline-box text-gray-800 bg-base-100 shadow-md m-0 w-max" >
125125 "Condition"
126126 </h3>
127- <InfoDescription
128- description=description. deref( ) . to_string( )
129- change_reason=change_reason. deref( ) . to_string( )
130- />
131- <Tooltip icon_class="ri-information-line ri-lg" >
132- <div class="flex flex-col gap-4" >
133- <div class="flex flex-col gap-1" >
134- <div class="font-bold" >"Created" </div>
135- <div class="flex gap-1 items-center" >
136- <i class="ri-user-line text-gray-950" />
137- <span>{ context. with_value( |c| c. created_by. clone( ) ) } </span>
138- </div>
139- <div class="flex gap-1 items-center" >
140- <i class="ri-time-line text-gray-950" />
141- <Datetime datetime=context. with_value( |c| c. created_at) />
142- </div>
143- </div>
144- <div class="flex flex-col gap-1" >
145- <div class="font-bold" >"Last Modified" </div>
146- <div class="flex gap-1 items-center" >
147- <i class="ri-user-line text-gray-950" />
148- <span>
149- { context. with_value( |c| c. last_modified_by. clone( ) ) }
150- </span>
151- </div>
152- <div class="flex gap-1 items-center" >
153- <i class="ri-time-line text-gray-950" />
154- <Datetime datetime=context. with_value( |c| c. last_modified_at) />
155- </div>
156- </div>
157- </div>
158- </Tooltip >
159127 </div>
160128 <Show when=move || actions_supported>
161- <div class="h-fit flex gap-4 text-right" >
129+ <div class="h-fit flex gap-2 items-center text-right" >
130+ <A href=href. with_value( |h| h. clone( ) ) class="btn btn-sm btn-ghost" >
131+ { "See More" }
132+ </A >
162133 <ContextOptions
163134 handle_create_experiment=move |_| {
164135 handle_create_experiment. call( context. with_value( |c| c. id. clone( ) ) )
0 commit comments