@visns-studio/visns-components 5.11.6 → 5.11.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/crm/Field.jsx +209 -82
- package/src/components/crm/generic/GenericQuote.jsx +454 -121
- package/src/components/crm/generic/styles/GenericQuote.module.scss +580 -40
- package/src/components/crm/styles/Field.module.scss +301 -0
- package/src/components/proposal/ProposalTemplatePreview.css +92 -0
- package/src/components/proposal/ProposalTemplatePreview.jsx +7 -1
- package/src/components/proposal/ProposalTemplateSectionManager.css +69 -10
- package/src/components/proposal/ProposalTemplateSectionManager.jsx +33 -7
- package/src/components/proposal/SectionEditor.css +62 -7
- package/src/components/proposal/SectionEditor.jsx +48 -14
- package/src/components/proposal/SectionTypeSelector.css +54 -0
- package/src/components/proposal/SectionTypeSelector.jsx +15 -3
|
@@ -816,3 +816,304 @@ input[type='file']:hover {
|
|
|
816
816
|
width: 1.2em;
|
|
817
817
|
height: 1.2em;
|
|
818
818
|
}
|
|
819
|
+
|
|
820
|
+
/* Enhanced File Upload Styling */
|
|
821
|
+
.single-file-container {
|
|
822
|
+
display: flex;
|
|
823
|
+
flex-direction: column;
|
|
824
|
+
gap: 0.75em;
|
|
825
|
+
width: 100%;
|
|
826
|
+
padding: 0.5em;
|
|
827
|
+
border: 2px dashed var(--border-color, #ddd);
|
|
828
|
+
border-radius: var(--br, 8px);
|
|
829
|
+
background: var(--tertiary-color, #fafafa);
|
|
830
|
+
transition: all 0.3s ease;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.single-file-container:hover {
|
|
834
|
+
border-color: var(--primary-color, #007bff);
|
|
835
|
+
background: rgba(var(--primary-color-rgb, 0, 123, 255), 0.02);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.single-file-image {
|
|
839
|
+
border-color: var(--success-color, #28a745);
|
|
840
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.05);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
.single-file-image:hover {
|
|
844
|
+
border-color: var(--success-color, #28a745);
|
|
845
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.1);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
.file-upload-button {
|
|
849
|
+
display: flex;
|
|
850
|
+
align-items: center;
|
|
851
|
+
gap: 0.5em;
|
|
852
|
+
padding: 1em 1.5em;
|
|
853
|
+
border: 1px solid var(--border-color, #ccc);
|
|
854
|
+
border-radius: var(--br, 6px);
|
|
855
|
+
background: var(--tertiary-color, #f8f9fa);
|
|
856
|
+
color: var(--paragraph-color, #333);
|
|
857
|
+
cursor: pointer;
|
|
858
|
+
transition: all 0.3s ease;
|
|
859
|
+
font-size: 0.9em;
|
|
860
|
+
font-weight: 500;
|
|
861
|
+
text-decoration: none;
|
|
862
|
+
outline: none;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.file-upload-button:hover {
|
|
866
|
+
background: var(--primary-color, #007bff);
|
|
867
|
+
color: var(--secondary-color, #fff);
|
|
868
|
+
border-color: var(--primary-color, #007bff);
|
|
869
|
+
transform: translateY(-1px);
|
|
870
|
+
box-shadow: 0 2px 8px rgba(var(--primary-color-rgb, 0, 123, 255), 0.3);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
.file-upload-button-image {
|
|
874
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.1);
|
|
875
|
+
border-color: var(--success-color, #28a745);
|
|
876
|
+
color: var(--success-color, #28a745);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.file-upload-button-image:hover {
|
|
880
|
+
background: var(--success-color, #28a745);
|
|
881
|
+
color: var(--secondary-color, #fff);
|
|
882
|
+
border-color: var(--success-color, #28a745);
|
|
883
|
+
box-shadow: 0 2px 8px rgba(var(--success-color-rgb, 40, 167, 69), 0.3);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.file-button-icon {
|
|
887
|
+
font-size: 1.2em;
|
|
888
|
+
display: flex;
|
|
889
|
+
align-items: center;
|
|
890
|
+
justify-content: center;
|
|
891
|
+
width: 1.5em;
|
|
892
|
+
height: 1.5em;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
.file-button-text {
|
|
896
|
+
font-weight: 500;
|
|
897
|
+
letter-spacing: 0.01em;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.file-info {
|
|
901
|
+
display: flex;
|
|
902
|
+
align-items: center;
|
|
903
|
+
justify-content: space-between;
|
|
904
|
+
gap: 1em;
|
|
905
|
+
padding: 0.75em 1em;
|
|
906
|
+
background: rgba(var(--item-color-rgb, 255, 255, 255), 0.8);
|
|
907
|
+
border: 1px solid var(--border-color, #e9ecef);
|
|
908
|
+
border-radius: var(--br, 6px);
|
|
909
|
+
font-size: 0.85em;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
.file-name-display {
|
|
913
|
+
flex: 1;
|
|
914
|
+
color: var(--paragraph-color, #495057);
|
|
915
|
+
font-weight: 500;
|
|
916
|
+
overflow: hidden;
|
|
917
|
+
text-overflow: ellipsis;
|
|
918
|
+
white-space: nowrap;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
.download-button {
|
|
922
|
+
display: flex;
|
|
923
|
+
align-items: center;
|
|
924
|
+
justify-content: center;
|
|
925
|
+
padding: 0.5em;
|
|
926
|
+
background: transparent;
|
|
927
|
+
border: 1px solid var(--border-color, #ccc);
|
|
928
|
+
border-radius: var(--br, 4px);
|
|
929
|
+
color: var(--primary-color, #007bff);
|
|
930
|
+
cursor: pointer;
|
|
931
|
+
transition: all 0.3s ease;
|
|
932
|
+
outline: none;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.download-button:hover {
|
|
936
|
+
background: var(--primary-color, #007bff);
|
|
937
|
+
color: var(--secondary-color, #fff);
|
|
938
|
+
border-color: var(--primary-color, #007bff);
|
|
939
|
+
transform: scale(1.05);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/* Enhanced Multiple File List Styling */
|
|
943
|
+
.file-list-item,
|
|
944
|
+
.file-list-item-image {
|
|
945
|
+
display: flex;
|
|
946
|
+
align-items: center;
|
|
947
|
+
gap: 0.75em;
|
|
948
|
+
padding: 0.75em 1em;
|
|
949
|
+
border-bottom: 1px solid var(--border-color, #e9ecef);
|
|
950
|
+
font-size: 0.9rem;
|
|
951
|
+
background: var(--item-color, #fff);
|
|
952
|
+
border-radius: var(--br, 6px);
|
|
953
|
+
transition: all 0.3s ease;
|
|
954
|
+
margin-bottom: 0.5em;
|
|
955
|
+
border: 1px solid transparent;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
.file-list-item-image {
|
|
959
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.05);
|
|
960
|
+
border-color: rgba(var(--success-color-rgb, 40, 167, 69), 0.2);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.file-list-item:hover,
|
|
964
|
+
.file-list-item-image:hover {
|
|
965
|
+
background: rgba(var(--primary-color-rgb, 0, 123, 255), 0.05);
|
|
966
|
+
border-color: var(--primary-color, #007bff);
|
|
967
|
+
transform: translateY(-1px);
|
|
968
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
.file-list-item-image:hover {
|
|
972
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.1);
|
|
973
|
+
border-color: var(--success-color, #28a745);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
.file-icon {
|
|
977
|
+
font-size: 1.5em;
|
|
978
|
+
display: flex;
|
|
979
|
+
align-items: center;
|
|
980
|
+
justify-content: center;
|
|
981
|
+
width: 2em;
|
|
982
|
+
height: 2em;
|
|
983
|
+
flex-shrink: 0;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
.file-name {
|
|
987
|
+
flex: 1;
|
|
988
|
+
color: var(--paragraph-color, #495057);
|
|
989
|
+
font-weight: 500;
|
|
990
|
+
overflow: hidden;
|
|
991
|
+
text-overflow: ellipsis;
|
|
992
|
+
white-space: nowrap;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/* Image Preview Styling */
|
|
996
|
+
.image-preview-container {
|
|
997
|
+
display: flex;
|
|
998
|
+
justify-content: center;
|
|
999
|
+
align-items: center;
|
|
1000
|
+
margin-bottom: 1em;
|
|
1001
|
+
padding: 0.5em;
|
|
1002
|
+
background: rgba(var(--item-color-rgb, 255, 255, 255), 0.9);
|
|
1003
|
+
border: 1px solid var(--border-color, #e9ecef);
|
|
1004
|
+
border-radius: var(--br, 6px);
|
|
1005
|
+
overflow: hidden;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.image-preview {
|
|
1009
|
+
max-width: 200px;
|
|
1010
|
+
max-height: 150px;
|
|
1011
|
+
width: auto;
|
|
1012
|
+
height: auto;
|
|
1013
|
+
object-fit: contain;
|
|
1014
|
+
border-radius: var(--br, 4px);
|
|
1015
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
1016
|
+
transition: transform 0.3s ease;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.image-preview:hover {
|
|
1020
|
+
transform: scale(1.05);
|
|
1021
|
+
cursor: pointer;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
.file-details {
|
|
1025
|
+
display: flex;
|
|
1026
|
+
align-items: center;
|
|
1027
|
+
justify-content: space-between;
|
|
1028
|
+
gap: 1em;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/* Multiple File Image Preview */
|
|
1032
|
+
.file-image-preview {
|
|
1033
|
+
display: flex;
|
|
1034
|
+
align-items: center;
|
|
1035
|
+
justify-content: center;
|
|
1036
|
+
width: 3em;
|
|
1037
|
+
height: 3em;
|
|
1038
|
+
flex-shrink: 0;
|
|
1039
|
+
background: rgba(var(--item-color-rgb, 255, 255, 255), 0.9);
|
|
1040
|
+
border: 1px solid var(--border-color, #e9ecef);
|
|
1041
|
+
border-radius: var(--br, 4px);
|
|
1042
|
+
overflow: hidden;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
.file-thumbnail {
|
|
1046
|
+
width: 100%;
|
|
1047
|
+
height: 100%;
|
|
1048
|
+
object-fit: cover;
|
|
1049
|
+
border-radius: var(--br, 4px);
|
|
1050
|
+
transition: transform 0.3s ease;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
.file-thumbnail:hover {
|
|
1054
|
+
transform: scale(1.1);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/* Enhanced Multiple File List Layout */
|
|
1058
|
+
.file-list-item,
|
|
1059
|
+
.file-list-item-image {
|
|
1060
|
+
display: grid;
|
|
1061
|
+
grid-template-columns: auto 1fr auto;
|
|
1062
|
+
align-items: center;
|
|
1063
|
+
gap: 1em;
|
|
1064
|
+
padding: 0.75em 1em;
|
|
1065
|
+
border-bottom: 1px solid var(--border-color, #e9ecef);
|
|
1066
|
+
font-size: 0.9rem;
|
|
1067
|
+
background: var(--item-color, #fff);
|
|
1068
|
+
border-radius: var(--br, 6px);
|
|
1069
|
+
transition: all 0.3s ease;
|
|
1070
|
+
margin-bottom: 0.5em;
|
|
1071
|
+
border: 1px solid transparent;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
.file-list-item-image {
|
|
1075
|
+
background: rgba(var(--success-color-rgb, 40, 167, 69), 0.05);
|
|
1076
|
+
border-color: rgba(var(--success-color-rgb, 40, 167, 69), 0.2);
|
|
1077
|
+
grid-template-columns: auto 1fr auto; /* Consistent grid for images */
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/* Responsive Design */
|
|
1081
|
+
@media (max-width: 768px) {
|
|
1082
|
+
.image-preview {
|
|
1083
|
+
max-width: 150px;
|
|
1084
|
+
max-height: 100px;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
.file-image-preview {
|
|
1088
|
+
width: 2.5em;
|
|
1089
|
+
height: 2.5em;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.file-info {
|
|
1093
|
+
flex-direction: column;
|
|
1094
|
+
align-items: stretch;
|
|
1095
|
+
gap: 0.75em;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.file-details {
|
|
1099
|
+
flex-direction: column;
|
|
1100
|
+
align-items: stretch;
|
|
1101
|
+
gap: 0.5em;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
@media (max-width: 480px) {
|
|
1106
|
+
.image-preview {
|
|
1107
|
+
max-width: 120px;
|
|
1108
|
+
max-height: 80px;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.single-file-container {
|
|
1112
|
+
padding: 0.25em;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
.file-upload-button {
|
|
1116
|
+
padding: 0.75em 1em;
|
|
1117
|
+
font-size: 0.85em;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
@@ -218,6 +218,52 @@
|
|
|
218
218
|
color: #374151;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
/* Compact HTML content styling for proposal previews */
|
|
222
|
+
.proposal-preview-prose h1,
|
|
223
|
+
.proposal-preview-prose h2,
|
|
224
|
+
.proposal-preview-prose h3,
|
|
225
|
+
.proposal-preview-prose h4,
|
|
226
|
+
.proposal-preview-prose h5,
|
|
227
|
+
.proposal-preview-prose h6 {
|
|
228
|
+
font-size: 0.95rem !important;
|
|
229
|
+
line-height: 1.2 !important;
|
|
230
|
+
margin: 0 0 0.5rem 0 !important;
|
|
231
|
+
font-weight: 600;
|
|
232
|
+
color: #374151 !important;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.proposal-preview-prose p {
|
|
236
|
+
font-size: 0.875rem !important;
|
|
237
|
+
line-height: 1.4 !important;
|
|
238
|
+
margin: 0 0 0.5rem 0 !important;
|
|
239
|
+
color: #374151 !important;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.proposal-preview-prose ul,
|
|
243
|
+
.proposal-preview-prose ol {
|
|
244
|
+
font-size: 0.875rem !important;
|
|
245
|
+
line-height: 1.4 !important;
|
|
246
|
+
margin: 0.5rem 0 0.5rem 1rem !important;
|
|
247
|
+
padding-left: 0 !important;
|
|
248
|
+
color: #374151 !important;
|
|
249
|
+
list-style-type: disc !important;
|
|
250
|
+
list-style-position: outside !important;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.proposal-preview-prose ol {
|
|
254
|
+
list-style-type: decimal !important;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.proposal-preview-prose li {
|
|
258
|
+
margin: 0.25rem 0 !important;
|
|
259
|
+
padding-left: 1.2rem !important;
|
|
260
|
+
margin-left: 0 !important;
|
|
261
|
+
font-size: 0.875rem !important;
|
|
262
|
+
line-height: 1.4 !important;
|
|
263
|
+
display: list-item !important;
|
|
264
|
+
text-indent: 0 !important;
|
|
265
|
+
}
|
|
266
|
+
|
|
221
267
|
.proposal-preview-section {
|
|
222
268
|
border-bottom: 1px solid #f3f4f6;
|
|
223
269
|
padding-bottom: 1.5rem;
|
|
@@ -242,6 +288,52 @@
|
|
|
242
288
|
line-height: 1.6;
|
|
243
289
|
}
|
|
244
290
|
|
|
291
|
+
/* Compact HTML content styling for individual section content */
|
|
292
|
+
.proposal-preview-section-content h1,
|
|
293
|
+
.proposal-preview-section-content h2,
|
|
294
|
+
.proposal-preview-section-content h3,
|
|
295
|
+
.proposal-preview-section-content h4,
|
|
296
|
+
.proposal-preview-section-content h5,
|
|
297
|
+
.proposal-preview-section-content h6 {
|
|
298
|
+
font-size: 0.95rem !important;
|
|
299
|
+
line-height: 1.2 !important;
|
|
300
|
+
margin: 0 0 0.5rem 0 !important;
|
|
301
|
+
font-weight: 600;
|
|
302
|
+
color: #4b5563 !important;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.proposal-preview-section-content p {
|
|
306
|
+
font-size: 0.875rem !important;
|
|
307
|
+
line-height: 1.4 !important;
|
|
308
|
+
margin: 0 0 0.5rem 0 !important;
|
|
309
|
+
color: #4b5563 !important;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.proposal-preview-section-content ul,
|
|
313
|
+
.proposal-preview-section-content ol {
|
|
314
|
+
font-size: 0.875rem !important;
|
|
315
|
+
line-height: 1.4 !important;
|
|
316
|
+
margin: 0.5rem 0 0.5rem 1rem !important;
|
|
317
|
+
padding-left: 0 !important;
|
|
318
|
+
color: #4b5563 !important;
|
|
319
|
+
list-style-type: disc !important;
|
|
320
|
+
list-style-position: outside !important;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.proposal-preview-section-content ol {
|
|
324
|
+
list-style-type: decimal !important;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.proposal-preview-section-content li {
|
|
328
|
+
margin: 0.25rem 0 !important;
|
|
329
|
+
padding-left: 1.2rem !important;
|
|
330
|
+
margin-left: 0 !important;
|
|
331
|
+
font-size: 0.875rem !important;
|
|
332
|
+
line-height: 1.4 !important;
|
|
333
|
+
display: list-item !important;
|
|
334
|
+
text-indent: 0 !important;
|
|
335
|
+
}
|
|
336
|
+
|
|
245
337
|
.proposal-preview-empty {
|
|
246
338
|
text-align: center;
|
|
247
339
|
padding: 3rem 1rem;
|
|
@@ -100,7 +100,13 @@ const ProposalTemplatePreview = ({
|
|
|
100
100
|
|
|
101
101
|
const data = await response.json();
|
|
102
102
|
if (data.success) {
|
|
103
|
-
|
|
103
|
+
// Ensure variables_used exists, fallback to client-side extraction
|
|
104
|
+
const responseData = {
|
|
105
|
+
...data.data,
|
|
106
|
+
variables_used: data.data.variables_used || extractVariablesFromSections(data.data.sections || [])
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
setPreviewData(responseData);
|
|
104
110
|
} else {
|
|
105
111
|
throw new Error(data.message || 'Failed to load preview');
|
|
106
112
|
}
|
|
@@ -15,10 +15,42 @@
|
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.section-item:hover {
|
|
18
|
+
.section-item:hover:not(.sortable-helper) {
|
|
19
19
|
box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.1);
|
|
20
20
|
border-color: #cbd5e1;
|
|
21
|
-
transform
|
|
21
|
+
/* Remove transform to prevent conflicts with sortable transforms */
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Sortable Helper Styles - Applied during drag */
|
|
25
|
+
.sortable-helper {
|
|
26
|
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
|
|
27
|
+
border-color: #3b82f6 !important;
|
|
28
|
+
transform: rotate(2deg) !important;
|
|
29
|
+
z-index: 9999 !important;
|
|
30
|
+
background: rgba(255, 255, 255, 0.95) !important;
|
|
31
|
+
backdrop-filter: blur(4px);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.sortable-helper .section-header {
|
|
35
|
+
background: rgba(59, 130, 246, 0.1) !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Prevent hover effects during drag */
|
|
39
|
+
.sortable-helper:hover {
|
|
40
|
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
|
|
41
|
+
border-color: #3b82f6 !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Smooth transitions for non-dragged items */
|
|
45
|
+
.section-item:not(.sortable-helper) {
|
|
46
|
+
transition: all 0.2s ease-in-out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* Ghost/placeholder styling */
|
|
50
|
+
.sortable-ghost {
|
|
51
|
+
opacity: 0.4;
|
|
52
|
+
background: #f8fafc !important;
|
|
53
|
+
border: 2px dashed #cbd5e1 !important;
|
|
22
54
|
}
|
|
23
55
|
|
|
24
56
|
.section-header {
|
|
@@ -38,14 +70,24 @@
|
|
|
38
70
|
}
|
|
39
71
|
|
|
40
72
|
.drag-handle {
|
|
41
|
-
cursor:
|
|
73
|
+
cursor: grab;
|
|
42
74
|
padding: 0.5rem;
|
|
43
75
|
color: #9ca3af;
|
|
44
|
-
transition:
|
|
76
|
+
transition: all 0.2s ease;
|
|
77
|
+
border-radius: 4px;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
45
81
|
}
|
|
46
82
|
|
|
47
83
|
.drag-handle:hover {
|
|
48
|
-
color: #
|
|
84
|
+
color: #3b82f6;
|
|
85
|
+
background: rgba(59, 130, 246, 0.05);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.drag-handle:active {
|
|
89
|
+
cursor: grabbing;
|
|
90
|
+
background: rgba(59, 130, 246, 0.1);
|
|
49
91
|
}
|
|
50
92
|
|
|
51
93
|
.section-title {
|
|
@@ -145,20 +187,37 @@
|
|
|
145
187
|
.section-content-preview h1,
|
|
146
188
|
.section-content-preview h2,
|
|
147
189
|
.section-content-preview h3,
|
|
148
|
-
.section-content-preview h4
|
|
149
|
-
|
|
150
|
-
|
|
190
|
+
.section-content-preview h4,
|
|
191
|
+
.section-content-preview h5,
|
|
192
|
+
.section-content-preview h6 {
|
|
193
|
+
font-size: 0.8rem !important;
|
|
194
|
+
line-height: 1.1 !important;
|
|
195
|
+
margin: 0 0 0.125rem 0 !important;
|
|
151
196
|
font-weight: 600;
|
|
197
|
+
color: #475569 !important;
|
|
152
198
|
}
|
|
153
199
|
|
|
154
200
|
.section-content-preview p {
|
|
155
|
-
|
|
201
|
+
font-size: 0.75rem !important;
|
|
202
|
+
line-height: 1.2 !important;
|
|
203
|
+
margin: 0 0 0.125rem 0 !important;
|
|
204
|
+
color: #475569 !important;
|
|
156
205
|
}
|
|
157
206
|
|
|
158
207
|
.section-content-preview ul,
|
|
159
208
|
.section-content-preview ol {
|
|
160
|
-
|
|
209
|
+
font-size: 0.75rem !important;
|
|
210
|
+
line-height: 1.2 !important;
|
|
211
|
+
margin: 0 0 0.125rem 1rem !important;
|
|
161
212
|
padding: 0;
|
|
213
|
+
color: #475569 !important;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.section-content-preview li {
|
|
217
|
+
margin: 0 !important;
|
|
218
|
+
padding: 0 !important;
|
|
219
|
+
font-size: 0.75rem !important;
|
|
220
|
+
line-height: 1.2 !important;
|
|
162
221
|
}
|
|
163
222
|
|
|
164
223
|
.section-no-content {
|
|
@@ -90,7 +90,7 @@ const SortableSectionList = SortableContainer(({ sections, onEdit, onDelete, onT
|
|
|
90
90
|
<div>
|
|
91
91
|
{sections.map((section, index) => (
|
|
92
92
|
<SortableSection
|
|
93
|
-
key={
|
|
93
|
+
key={section.id}
|
|
94
94
|
index={index}
|
|
95
95
|
section={section}
|
|
96
96
|
onEdit={onEdit}
|
|
@@ -164,11 +164,12 @@ const ProposalTemplateSectionManager = ({
|
|
|
164
164
|
sort_order: index + 1
|
|
165
165
|
}));
|
|
166
166
|
|
|
167
|
+
// Immediately update UI for smooth experience
|
|
167
168
|
setSections(updatedSections);
|
|
168
169
|
|
|
169
170
|
try {
|
|
170
171
|
// Update sort orders on the backend
|
|
171
|
-
await fetch(buildUrlWithTemplate(apiEndpoints.sectionsReorder), {
|
|
172
|
+
const response = await fetch(buildUrlWithTemplate(apiEndpoints.sectionsReorder), {
|
|
172
173
|
method: 'POST',
|
|
173
174
|
headers: {
|
|
174
175
|
'Content-Type': 'application/json',
|
|
@@ -178,19 +179,33 @@ const ProposalTemplateSectionManager = ({
|
|
|
178
179
|
sections: updatedSections.map(s => ({ id: s.id, sort_order: s.sort_order }))
|
|
179
180
|
})
|
|
180
181
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
|
|
183
|
+
if (response.ok) {
|
|
184
|
+
// Don't refetch data immediately to prevent UI jumping
|
|
185
|
+
// The local state is already updated and accurate
|
|
186
|
+
toast.success('Section order updated');
|
|
187
|
+
} else {
|
|
188
|
+
throw new Error('Failed to update section order');
|
|
189
|
+
}
|
|
184
190
|
} catch (error) {
|
|
185
191
|
console.error('Error updating section order:', error);
|
|
186
192
|
toast.error('Failed to update section order');
|
|
187
|
-
// Revert on error
|
|
188
|
-
|
|
193
|
+
// Revert to original order on error
|
|
194
|
+
setSections(sections);
|
|
189
195
|
}
|
|
190
196
|
};
|
|
191
197
|
|
|
192
198
|
const handleAddSection = async (sectionType) => {
|
|
193
199
|
try {
|
|
200
|
+
// Check if a section with this type already exists
|
|
201
|
+
const existingSection = sections.find(section => section.section_type === sectionType);
|
|
202
|
+
|
|
203
|
+
if (existingSection) {
|
|
204
|
+
const sectionTypeName = sectionType.replace('_', ' ').replace(/\b\w/g, l => l.toUpperCase());
|
|
205
|
+
toast.error(`A ${sectionTypeName} section already exists in this template. Each template can only have one section of each type.`);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
194
209
|
const response = await fetch(buildUrlWithTemplate(apiEndpoints.sectionsCreate), {
|
|
195
210
|
method: 'POST',
|
|
196
211
|
headers: {
|
|
@@ -447,6 +462,16 @@ const ProposalTemplateSectionManager = ({
|
|
|
447
462
|
onDelete={handleDeleteSection}
|
|
448
463
|
onToggleVisibility={handleToggleVisibility}
|
|
449
464
|
useDragHandle
|
|
465
|
+
lockAxis="y"
|
|
466
|
+
helperClass="sortable-helper"
|
|
467
|
+
transitionDuration={200}
|
|
468
|
+
shouldCancelStart={(e) => {
|
|
469
|
+
// Prevent drag from starting on interactive elements
|
|
470
|
+
if (e.target.closest('button, input, textarea, select, a')) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
return false;
|
|
474
|
+
}}
|
|
450
475
|
/>
|
|
451
476
|
)}
|
|
452
477
|
|
|
@@ -454,6 +479,7 @@ const ProposalTemplateSectionManager = ({
|
|
|
454
479
|
<SectionTypeSelector
|
|
455
480
|
onSelect={handleAddSection}
|
|
456
481
|
onCancel={() => setShowSectionTypeSelector(false)}
|
|
482
|
+
existingSections={sections}
|
|
457
483
|
/>
|
|
458
484
|
)}
|
|
459
485
|
|
|
@@ -247,23 +247,78 @@
|
|
|
247
247
|
color: #374151;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/* Compact HTML content styling for section editor preview */
|
|
250
251
|
.section-editor-preview .prose h1,
|
|
251
252
|
.section-editor-preview .prose h2,
|
|
252
253
|
.section-editor-preview .prose h3,
|
|
253
|
-
.section-editor-preview .prose h4
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
.section-editor-preview .prose h4,
|
|
255
|
+
.section-editor-preview .prose h5,
|
|
256
|
+
.section-editor-preview .prose h6 {
|
|
257
|
+
font-size: 0.95rem !important;
|
|
258
|
+
line-height: 1.2 !important;
|
|
259
|
+
margin: 0 0 0.5rem 0 !important;
|
|
260
|
+
font-weight: 600;
|
|
261
|
+
color: #1f2937 !important;
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
.section-editor-preview .prose p {
|
|
260
|
-
|
|
265
|
+
font-size: 0.875rem !important;
|
|
266
|
+
line-height: 1.4 !important;
|
|
267
|
+
margin: 0 0 0.5rem 0 !important;
|
|
268
|
+
color: #374151 !important;
|
|
261
269
|
}
|
|
262
270
|
|
|
263
271
|
.section-editor-preview .prose ul,
|
|
264
272
|
.section-editor-preview .prose ol {
|
|
265
|
-
|
|
266
|
-
|
|
273
|
+
font-size: 0.875rem !important;
|
|
274
|
+
line-height: 1.4 !important;
|
|
275
|
+
margin: 0 0 0.5rem 1rem !important;
|
|
276
|
+
padding: 0;
|
|
277
|
+
color: #374151 !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.section-editor-preview .prose li {
|
|
281
|
+
margin: 0 !important;
|
|
282
|
+
padding: 0 !important;
|
|
283
|
+
font-size: 0.875rem !important;
|
|
284
|
+
line-height: 1.4 !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* Also apply to direct preview content without prose class */
|
|
288
|
+
.section-editor-preview h1,
|
|
289
|
+
.section-editor-preview h2,
|
|
290
|
+
.section-editor-preview h3,
|
|
291
|
+
.section-editor-preview h4,
|
|
292
|
+
.section-editor-preview h5,
|
|
293
|
+
.section-editor-preview h6 {
|
|
294
|
+
font-size: 0.95rem !important;
|
|
295
|
+
line-height: 1.2 !important;
|
|
296
|
+
margin: 0 0 0.5rem 0 !important;
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
color: #1f2937 !important;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.section-editor-preview p {
|
|
302
|
+
font-size: 0.875rem !important;
|
|
303
|
+
line-height: 1.4 !important;
|
|
304
|
+
margin: 0 0 0.5rem 0 !important;
|
|
305
|
+
color: #374151 !important;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.section-editor-preview ul,
|
|
309
|
+
.section-editor-preview ol {
|
|
310
|
+
font-size: 0.875rem !important;
|
|
311
|
+
line-height: 1.4 !important;
|
|
312
|
+
margin: 0 0 0.5rem 1rem !important;
|
|
313
|
+
padding: 0;
|
|
314
|
+
color: #374151 !important;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.section-editor-preview li {
|
|
318
|
+
margin: 0 !important;
|
|
319
|
+
padding: 0 !important;
|
|
320
|
+
font-size: 0.875rem !important;
|
|
321
|
+
line-height: 1.4 !important;
|
|
267
322
|
}
|
|
268
323
|
|
|
269
324
|
.section-editor-styling-panel {
|