wepee commited on
Commit
ab45a50
·
1 Parent(s): e6b7e49

debug: fix chatbox not floated

Browse files
resources/css/app.css CHANGED
@@ -331,7 +331,7 @@ @layer components {
331
  }
332
 
333
  .welcome-theme-toggle {
334
- @apply absolute right-4 top-4 h-10 w-10 rounded-[10px] shadow-none backdrop-blur sm:right-8 sm:top-8;
335
  background-color: var(--welcome-toggle-bg);
336
  border-color: var(--welcome-card-active-border);
337
  color: var(--welcome-accent);
@@ -344,7 +344,7 @@ @layer components {
344
  }
345
 
346
  .welcome-title {
347
- @apply text-center text-[34px] font-bold leading-tight tracking-[0.01em] sm:text-[40px];
348
  color: var(--welcome-title);
349
  }
350
 
@@ -394,7 +394,7 @@ @layer components {
394
  }
395
 
396
  .welcome-entry-title {
397
- @apply truncate text-left text-lg font-semibold leading-tight;
398
  color: var(--welcome-title);
399
  }
400
 
@@ -414,7 +414,7 @@ @layer components {
414
  }
415
 
416
  .welcome-register-link {
417
- @apply font-medium underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2;
418
  color: var(--welcome-accent);
419
  --tw-ring-color: color-mix(
420
  in oklab,
@@ -463,7 +463,7 @@ @layer components {
463
  }
464
 
465
  .register-back-link {
466
- @apply inline-flex text-sm font-semibold underline-offset-4 transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2;
467
  color: var(--welcome-subtitle);
468
  --tw-ring-color: color-mix(
469
  in oklab,
@@ -473,7 +473,7 @@ @layer components {
473
  }
474
 
475
  .register-heading {
476
- @apply mt-2 text-center text-2xl font-semibold leading-tight;
477
  color: var(--welcome-title);
478
  }
479
 
@@ -486,7 +486,7 @@ @layer components {
486
  }
487
 
488
  .register-label {
489
- @apply text-base font-medium leading-none;
490
  color: var(--welcome-title);
491
  }
492
 
@@ -521,7 +521,7 @@ @layer components {
521
  }
522
 
523
  .register-error {
524
- @apply text-sm font-medium leading-snug;
525
  color: var(--register-danger);
526
  }
527
 
@@ -561,7 +561,7 @@ @layer components {
561
  }
562
 
563
  .login-remember-label {
564
- @apply text-sm font-normal leading-none;
565
  color: var(--welcome-subtitle);
566
  }
567
 
@@ -611,7 +611,7 @@ @layer components {
611
  }
612
 
613
  .student-logo-action {
614
- @apply flex size-8 shrink-0 items-center justify-center rounded-[8px] outline-none transition-transform focus-visible:ring-2;
615
  --tw-ring-color: color-mix(
616
  in oklab,
617
  var(--student-primary) 45%,
@@ -702,7 +702,7 @@ @layer components {
702
  }
703
 
704
  .student-history-delete {
705
- @apply absolute right-2 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-[6px] opacity-0 transition-opacity;
706
  color: var(--student-danger);
707
  }
708
 
@@ -795,7 +795,7 @@ @layer components {
795
  }
796
 
797
  .student-history-title {
798
- @apply block truncate text-[11px] font-medium leading-tight;
799
  color: var(--student-text);
800
  }
801
 
@@ -830,7 +830,7 @@ @layer components {
830
  }
831
 
832
  .student-user-name {
833
- @apply block truncate text-[11px] font-semibold leading-tight;
834
  color: var(--student-text);
835
  }
836
 
@@ -946,7 +946,7 @@ @layer components {
946
  }
947
 
948
  .student-greeting h2 {
949
- @apply text-3xl font-bold leading-tight tracking-[-0.02em];
950
  color: var(--student-text);
951
  }
952
 
@@ -1019,17 +1019,18 @@ @layer components {
1019
  }
1020
 
1021
  .student-floating-send {
1022
- @apply absolute bottom-4 right-5 size-8 rounded-[8px] shadow-none;
1023
  background-color: var(--student-primary) !important;
1024
  color: var(--student-primary-foreground) !important;
1025
  }
1026
 
1027
  .student-chat-stage--session {
1028
- @apply min-h-0 flex-col items-stretch justify-between overflow-hidden px-5 py-0;
1029
  }
1030
 
1031
  .student-chat-thread {
1032
- @apply min-h-0 w-full flex-1 overflow-y-auto overscroll-contain py-8;
 
1033
  }
1034
 
1035
  .student-chat-messages {
@@ -1042,7 +1043,7 @@ @layer components {
1042
  }
1043
 
1044
  .student-chat-status {
1045
- @apply mb-4 mt-0;
1046
  }
1047
 
1048
  .student-message {
@@ -1085,7 +1086,7 @@ @layer components {
1085
  }
1086
 
1087
  .student-message-content {
1088
- @apply whitespace-pre-wrap leading-relaxed;
1089
  }
1090
 
1091
  .student-message-time {
@@ -1112,12 +1113,23 @@ @layer components {
1112
  color: var(--student-muted);
1113
  }
1114
 
 
 
 
 
1115
  .student-chat-composer {
1116
- @apply w-full shrink-0 pb-8;
1117
  }
1118
 
1119
  .student-composer-card--dock {
1120
- @apply w-full;
 
 
 
 
 
 
 
1121
  }
1122
 
1123
  .student-composer-card--dock .student-composer-content {
@@ -1249,7 +1261,7 @@ @layer components {
1249
  }
1250
 
1251
  .lecturer-user-name {
1252
- @apply block truncate text-[11px] font-semibold leading-tight;
1253
  color: var(--lecturer-text);
1254
  }
1255
 
@@ -1323,7 +1335,7 @@ @layer components {
1323
  }
1324
 
1325
  .lecturer-page-header h1 {
1326
- @apply text-3xl font-bold leading-tight tracking-[-0.03em];
1327
  color: var(--lecturer-text);
1328
  }
1329
 
@@ -1382,7 +1394,7 @@ @layer components {
1382
 
1383
  .lecturer-form-input,
1384
  .lecturer-form-textarea {
1385
- @apply w-full rounded-[8px] border px-4 text-sm shadow-none outline-none transition-[border-color,box-shadow];
1386
  background-color: color-mix(
1387
  in oklab,
1388
  var(--lecturer-primary) 6%,
@@ -1460,7 +1472,7 @@ @layer components {
1460
  }
1461
 
1462
  .lecturer-metric-value-row strong {
1463
- @apply text-3xl font-bold leading-none;
1464
  color: var(--lecturer-text);
1465
  }
1466
 
@@ -1502,13 +1514,13 @@ @layer components {
1502
  }
1503
 
1504
  .lecturer-search-field svg {
1505
- @apply pointer-events-none absolute left-3 top-1/2 -translate-y-1/2;
1506
  color: var(--lecturer-muted);
1507
  z-index: 1;
1508
  }
1509
 
1510
  .lecturer-search-input {
1511
- @apply h-10 rounded-[9px] border text-sm shadow-none outline-none transition-[border-color,box-shadow];
1512
  background-color: color-mix(
1513
  in oklab,
1514
  var(--lecturer-primary) 5%,
@@ -1598,7 +1610,7 @@ @layer components {
1598
  }
1599
 
1600
  .lecturer-manage-button {
1601
- @apply inline-flex items-center justify-center gap-1 rounded-[7px] px-3 py-1.5 text-sm font-semibold outline-none transition-colors focus-visible:ring-2;
1602
  background-color: color-mix(
1603
  in oklab,
1604
  var(--lecturer-primary) 10%,
@@ -1633,7 +1645,7 @@ @layer components {
1633
  }
1634
 
1635
  .lecturer-detail-back {
1636
- @apply mt-1 inline-flex size-9 shrink-0 items-center justify-center rounded-full outline-none transition-colors focus-visible:ring-2;
1637
  color: var(--lecturer-muted);
1638
  --tw-ring-color: color-mix(
1639
  in oklab,
@@ -1656,12 +1668,12 @@ @layer components {
1656
  }
1657
 
1658
  .lecturer-detail-title-row h1 {
1659
- @apply text-3xl font-bold leading-tight tracking-[-0.03em];
1660
  color: var(--lecturer-text);
1661
  }
1662
 
1663
  .lecturer-detail-heading p {
1664
- @apply mt-1 text-base italic leading-relaxed;
1665
  color: var(--lecturer-muted);
1666
  }
1667
 
@@ -1734,7 +1746,7 @@ @layer components {
1734
  }
1735
 
1736
  .lecturer-upload-card {
1737
- @apply flex min-h-[185px] w-full flex-col items-center justify-center gap-3 rounded-[14px] border border-dashed px-6 py-8 text-center outline-none transition-colors focus-visible:ring-2;
1738
  background-color: color-mix(
1739
  in oklab,
1740
  var(--lecturer-primary) 6%,
@@ -1877,7 +1889,7 @@ @layer components {
1877
  }
1878
 
1879
  .lecturer-document-delete {
1880
- @apply inline-flex size-8 items-center justify-center rounded-[7px] outline-none transition-colors focus-visible:ring-2;
1881
  color: var(--lecturer-muted);
1882
  --tw-ring-color: color-mix(
1883
  in oklab,
@@ -1904,7 +1916,16 @@ @layer components {
1904
 
1905
  @media (max-width: 640px) {
1906
  .student-chat-stage--session {
 
 
 
 
1907
  @apply px-3;
 
 
 
 
 
1908
  }
1909
 
1910
  .student-message-bubble {
@@ -1912,7 +1933,7 @@ @layer components {
1912
  }
1913
 
1914
  .student-chat-composer {
1915
- @apply pb-4;
1916
  }
1917
 
1918
  .lecturer-page {
 
331
  }
332
 
333
  .welcome-theme-toggle {
334
+ @apply absolute top-4 right-4 h-10 w-10 rounded-[10px] shadow-none backdrop-blur sm:top-8 sm:right-8;
335
  background-color: var(--welcome-toggle-bg);
336
  border-color: var(--welcome-card-active-border);
337
  color: var(--welcome-accent);
 
344
  }
345
 
346
  .welcome-title {
347
+ @apply text-center text-[34px] leading-tight font-bold tracking-[0.01em] sm:text-[40px];
348
  color: var(--welcome-title);
349
  }
350
 
 
394
  }
395
 
396
  .welcome-entry-title {
397
+ @apply truncate text-left text-lg leading-tight font-semibold;
398
  color: var(--welcome-title);
399
  }
400
 
 
414
  }
415
 
416
  .welcome-register-link {
417
+ @apply font-medium underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:outline-none;
418
  color: var(--welcome-accent);
419
  --tw-ring-color: color-mix(
420
  in oklab,
 
463
  }
464
 
465
  .register-back-link {
466
+ @apply inline-flex text-sm font-semibold underline-offset-4 transition-colors hover:underline focus-visible:ring-2 focus-visible:outline-none;
467
  color: var(--welcome-subtitle);
468
  --tw-ring-color: color-mix(
469
  in oklab,
 
473
  }
474
 
475
  .register-heading {
476
+ @apply mt-2 text-center text-2xl leading-tight font-semibold;
477
  color: var(--welcome-title);
478
  }
479
 
 
486
  }
487
 
488
  .register-label {
489
+ @apply text-base leading-none font-medium;
490
  color: var(--welcome-title);
491
  }
492
 
 
521
  }
522
 
523
  .register-error {
524
+ @apply text-sm leading-snug font-medium;
525
  color: var(--register-danger);
526
  }
527
 
 
561
  }
562
 
563
  .login-remember-label {
564
+ @apply text-sm leading-none font-normal;
565
  color: var(--welcome-subtitle);
566
  }
567
 
 
611
  }
612
 
613
  .student-logo-action {
614
+ @apply flex size-8 shrink-0 items-center justify-center rounded-[8px] transition-transform outline-none focus-visible:ring-2;
615
  --tw-ring-color: color-mix(
616
  in oklab,
617
  var(--student-primary) 45%,
 
702
  }
703
 
704
  .student-history-delete {
705
+ @apply absolute top-1/2 right-2 flex size-6 -translate-y-1/2 items-center justify-center rounded-[6px] opacity-0 transition-opacity;
706
  color: var(--student-danger);
707
  }
708
 
 
795
  }
796
 
797
  .student-history-title {
798
+ @apply block truncate text-[11px] leading-tight font-medium;
799
  color: var(--student-text);
800
  }
801
 
 
830
  }
831
 
832
  .student-user-name {
833
+ @apply block truncate text-[11px] leading-tight font-semibold;
834
  color: var(--student-text);
835
  }
836
 
 
946
  }
947
 
948
  .student-greeting h2 {
949
+ @apply text-3xl leading-tight font-bold tracking-[-0.02em];
950
  color: var(--student-text);
951
  }
952
 
 
1019
  }
1020
 
1021
  .student-floating-send {
1022
+ @apply absolute right-5 bottom-4 size-8 rounded-[8px] shadow-none;
1023
  background-color: var(--student-primary) !important;
1024
  color: var(--student-primary-foreground) !important;
1025
  }
1026
 
1027
  .student-chat-stage--session {
1028
+ @apply relative min-h-0 flex-col items-stretch justify-between overflow-hidden px-0 py-0;
1029
  }
1030
 
1031
  .student-chat-thread {
1032
+ @apply min-h-0 w-full flex-1 overflow-y-auto overscroll-contain px-5 pt-8;
1033
+ padding-bottom: 12.5rem;
1034
  }
1035
 
1036
  .student-chat-messages {
 
1043
  }
1044
 
1045
  .student-chat-status {
1046
+ @apply mt-0 mb-4;
1047
  }
1048
 
1049
  .student-message {
 
1086
  }
1087
 
1088
  .student-message-content {
1089
+ @apply leading-relaxed whitespace-pre-wrap;
1090
  }
1091
 
1092
  .student-message-time {
 
1113
  color: var(--student-muted);
1114
  }
1115
 
1116
+ .student-chat-scroll-anchor {
1117
+ scroll-margin-bottom: 13.5rem;
1118
+ }
1119
+
1120
  .student-chat-composer {
1121
+ @apply pointer-events-none absolute right-5 bottom-8 left-5 z-10 w-auto pb-0;
1122
  }
1123
 
1124
  .student-composer-card--dock {
1125
+ @apply pointer-events-auto w-full;
1126
+ -webkit-backdrop-filter: blur(18px) saturate(1.25);
1127
+ backdrop-filter: blur(18px) saturate(1.25);
1128
+ background-color: color-mix(
1129
+ in oklab,
1130
+ var(--student-surface) 76%,
1131
+ transparent
1132
+ ) !important;
1133
  }
1134
 
1135
  .student-composer-card--dock .student-composer-content {
 
1261
  }
1262
 
1263
  .lecturer-user-name {
1264
+ @apply block truncate text-[11px] leading-tight font-semibold;
1265
  color: var(--lecturer-text);
1266
  }
1267
 
 
1335
  }
1336
 
1337
  .lecturer-page-header h1 {
1338
+ @apply text-3xl leading-tight font-bold tracking-[-0.03em];
1339
  color: var(--lecturer-text);
1340
  }
1341
 
 
1394
 
1395
  .lecturer-form-input,
1396
  .lecturer-form-textarea {
1397
+ @apply w-full rounded-[8px] border px-4 text-sm shadow-none transition-[border-color,box-shadow] outline-none;
1398
  background-color: color-mix(
1399
  in oklab,
1400
  var(--lecturer-primary) 6%,
 
1472
  }
1473
 
1474
  .lecturer-metric-value-row strong {
1475
+ @apply text-3xl leading-none font-bold;
1476
  color: var(--lecturer-text);
1477
  }
1478
 
 
1514
  }
1515
 
1516
  .lecturer-search-field svg {
1517
+ @apply pointer-events-none absolute top-1/2 left-3 -translate-y-1/2;
1518
  color: var(--lecturer-muted);
1519
  z-index: 1;
1520
  }
1521
 
1522
  .lecturer-search-input {
1523
+ @apply h-10 rounded-[9px] border text-sm shadow-none transition-[border-color,box-shadow] outline-none;
1524
  background-color: color-mix(
1525
  in oklab,
1526
  var(--lecturer-primary) 5%,
 
1610
  }
1611
 
1612
  .lecturer-manage-button {
1613
+ @apply inline-flex items-center justify-center gap-1 rounded-[7px] px-3 py-1.5 text-sm font-semibold transition-colors outline-none focus-visible:ring-2;
1614
  background-color: color-mix(
1615
  in oklab,
1616
  var(--lecturer-primary) 10%,
 
1645
  }
1646
 
1647
  .lecturer-detail-back {
1648
+ @apply mt-1 inline-flex size-9 shrink-0 items-center justify-center rounded-full transition-colors outline-none focus-visible:ring-2;
1649
  color: var(--lecturer-muted);
1650
  --tw-ring-color: color-mix(
1651
  in oklab,
 
1668
  }
1669
 
1670
  .lecturer-detail-title-row h1 {
1671
+ @apply text-3xl leading-tight font-bold tracking-[-0.03em];
1672
  color: var(--lecturer-text);
1673
  }
1674
 
1675
  .lecturer-detail-heading p {
1676
+ @apply mt-1 text-base leading-relaxed italic;
1677
  color: var(--lecturer-muted);
1678
  }
1679
 
 
1746
  }
1747
 
1748
  .lecturer-upload-card {
1749
+ @apply flex min-h-[185px] w-full flex-col items-center justify-center gap-3 rounded-[14px] border border-dashed px-6 py-8 text-center transition-colors outline-none focus-visible:ring-2;
1750
  background-color: color-mix(
1751
  in oklab,
1752
  var(--lecturer-primary) 6%,
 
1889
  }
1890
 
1891
  .lecturer-document-delete {
1892
+ @apply inline-flex size-8 items-center justify-center rounded-[7px] transition-colors outline-none focus-visible:ring-2;
1893
  color: var(--lecturer-muted);
1894
  --tw-ring-color: color-mix(
1895
  in oklab,
 
1916
 
1917
  @media (max-width: 640px) {
1918
  .student-chat-stage--session {
1919
+ @apply px-0;
1920
+ }
1921
+
1922
+ .student-chat-thread {
1923
  @apply px-3;
1924
+ padding-bottom: 11rem;
1925
+ }
1926
+
1927
+ .student-chat-scroll-anchor {
1928
+ scroll-margin-bottom: 12rem;
1929
  }
1930
 
1931
  .student-message-bubble {
 
1933
  }
1934
 
1935
  .student-chat-composer {
1936
+ @apply right-3 bottom-4 left-3 pb-0;
1937
  }
1938
 
1939
  .lecturer-page {
resources/js/pages/mahasiswa-chat.tsx CHANGED
@@ -155,7 +155,13 @@ export default function MahasiswaChat({ sessionId }: MahasiswaChatProps) {
155
  }, [courses, currentSession, selectedCourseId]);
156
 
157
  useEffect(() => {
158
- messagesEndRef.current?.scrollIntoView({ block: 'end' });
 
 
 
 
 
 
159
  }, [messages, isProcessing]);
160
 
161
  const getHistoryMessages = useCallback(
@@ -471,7 +477,10 @@ export default function MahasiswaChat({ sessionId }: MahasiswaChatProps) {
471
  </article>
472
  )}
473
 
474
- <div ref={messagesEndRef} />
 
 
 
475
  </div>
476
  )}
477
  </section>
 
155
  }, [courses, currentSession, selectedCourseId]);
156
 
157
  useEffect(() => {
158
+ const scrollFrame = window.requestAnimationFrame(() => {
159
+ messagesEndRef.current?.scrollIntoView({
160
+ block: 'end',
161
+ });
162
+ });
163
+
164
+ return () => window.cancelAnimationFrame(scrollFrame);
165
  }, [messages, isProcessing]);
166
 
167
  const getHistoryMessages = useCallback(
 
477
  </article>
478
  )}
479
 
480
+ <div
481
+ className="student-chat-scroll-anchor"
482
+ ref={messagesEndRef}
483
+ />
484
  </div>
485
  )}
486
  </section>