add chat :p
All checks were successful
Code quality checks / biome (push) Successful in 22s

This commit is contained in:
creations 2025-06-08 19:57:50 -04:00
parent ae3224c18b
commit a3b03fdec4
Signed by: creations
GPG key ID: 8F553AA4320FC711
14 changed files with 2200 additions and 37 deletions

453
public/css/chat.css Normal file
View file

@ -0,0 +1,453 @@
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
height: 100vh;
overflow: hidden;
}
.chat-widget {
height: 100vh;
display: flex;
flex-direction: column;
background: var(--bg-card);
border: 1px solid var(--border-primary);
}
.chat-header {
padding: 0.5rem;
border-bottom: 1px solid var(--border-primary);
background: var(--bg-secondary);
flex-shrink: 0;
}
.username-section {
display: flex;
gap: 0.5rem;
align-items: center;
}
.username-section .username-input {
flex: 1;
padding: 0.375rem;
font-size: 0.75rem;
border: 1px solid var(--border-primary);
border-radius: 0.25rem;
background: var(--bg-input);
color: var(--text-primary);
}
.username-section .username-input:focus {
outline: none;
border-color: var(--accent-blue);
}
.username-section .username-input::placeholder {
color: var(--text-secondary);
}
.chat-messages {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-height: 0;
}
.loading-state,
.error-state,
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1rem;
flex: 1;
}
.loading-state p,
.error-state p,
.empty-state p {
margin: 0.25rem 0 0 0;
font-size: 0.75rem;
color: var(--text-secondary);
}
.error-state p {
color: var(--accent-red);
}
.retry-btn {
background: var(--accent-blue);
color: white;
border: none;
padding: 0.375rem 0.75rem;
border-radius: 0.25rem;
font-size: 0.75rem;
cursor: pointer;
margin-top: 0.375rem;
}
.retry-btn:hover {
background: #2563eb;
}
.messages-container {
flex: 1;
overflow-y: auto;
padding: 0.5rem;
display: flex;
flex-direction: column;
gap: 0.375rem;
}
.message {
padding: 0.375rem 0.5rem;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: 0.375rem;
font-size: 0.75rem;
animation: messageSlideIn 0.2s ease-out;
}
.message.system-message {
background: var(--bg-primary);
opacity: 0.7;
text-align: center;
font-style: italic;
padding: 0.25rem 0.5rem;
}
.message-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.125rem;
}
.message-username {
font-weight: 600;
color: var(--accent-blue);
font-size: 0.6875rem;
}
.message-time {
font-size: 0.625rem;
color: var(--text-muted);
}
.message-content {
color: var(--text-primary);
word-wrap: break-word;
line-height: 1.2;
font-size: 0.6875rem;
}
.chat-input-form {
padding: 0.5rem;
border-top: 1px solid var(--border-primary);
background: var(--bg-secondary);
flex-shrink: 0;
}
.message-row {
display: flex;
gap: 0.375rem;
align-items: center;
}
.message-input {
flex: 1;
padding: 0.375rem;
font-size: 0.75rem;
border: 1px solid var(--border-primary);
border-radius: 0.25rem;
background: var(--bg-input);
color: var(--text-primary);
}
.message-input:focus {
outline: none;
border-color: var(--accent-blue);
}
.message-input::placeholder {
color: var(--text-secondary);
}
.send-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: var(--accent-blue);
border: none;
border-radius: 0.25rem;
color: white;
cursor: pointer;
flex-shrink: 0;
}
.send-btn:hover:not(:disabled) {
background: #2563eb;
}
.send-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.send-btn svg {
width: 14px;
height: 14px;
}
@keyframes messageSlideIn {
from {
opacity: 0;
transform: translateY(3px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.messages-container::-webkit-scrollbar {
width: 4px;
}
.messages-container::-webkit-scrollbar-track {
background: var(--bg-primary);
}
.messages-container::-webkit-scrollbar-thumb {
background: var(--border-secondary);
border-radius: 2px;
}
.messages-container::-webkit-scrollbar-thumb:hover {
background: var(--border-accent);
}
.settings-container {
position: relative;
display: inline-block;
}
.settings-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
border-radius: 0.25rem;
transition: all 0.2s ease;
flex-shrink: 0;
}
.settings-btn:hover {
color: var(--text-primary);
background: var(--bg-primary);
}
.settings-btn svg {
width: 14px;
height: 14px;
}
.settings-dropdown {
position: absolute;
top: 100%;
right: 0;
background: var(--bg-card);
border: 1px solid var(--border-primary);
border-radius: 0.375rem;
padding: 0.5rem;
min-width: 160px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 1000;
display: none;
margin-top: 0.375rem;
}
.settings-dropdown h4 {
margin: 0 0 0.5rem 0;
color: var(--text-primary);
font-size: 0.75rem;
font-weight: 600;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.375rem;
padding: 0.125rem 0;
}
.setting-item:last-child {
margin-bottom: 0;
}
.setting-label {
color: var(--text-secondary);
font-size: 0.6875rem;
}
.setting-toggle {
position: relative;
width: 32px;
height: 16px;
}
.setting-toggle input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--border-secondary);
transition: 0.3s;
border-radius: 16px;
}
.toggle-slider:before {
position: absolute;
content: "";
height: 12px;
width: 12px;
left: 2px;
bottom: 2px;
background-color: var(--text-primary);
transition: 0.3s;
border-radius: 50%;
}
input:checked + .toggle-slider {
background-color: var(--accent-blue);
}
input:checked + .toggle-slider:before {
transform: translateX(16px);
}
.message-image-container {
margin: 0.25rem 0;
}
.message-image {
max-width: 200px !important;
max-height: 120px !important;
border-radius: 4px !important;
margin: 0.25rem 0 !important;
display: block !important;
}
@media (max-width: 400px) {
.chat-header {
padding: 0.375rem;
}
.username-section {
gap: 0.375rem;
}
.username-section .username-input {
font-size: 0.6875rem;
padding: 0.25rem;
}
.settings-btn {
width: 28px;
height: 28px;
}
.settings-btn svg {
width: 12px;
height: 12px;
}
.message-input {
font-size: 0.6875rem;
padding: 0.25rem;
}
.send-btn {
width: 28px;
height: 28px;
}
.send-btn svg {
width: 12px;
height: 12px;
}
.message {
padding: 0.25rem 0.375rem;
}
.message-content,
.message-username {
font-size: 0.625rem;
}
.message-time {
font-size: 0.5625rem;
}
.messages-container {
padding: 0.375rem;
}
.chat-input-form {
padding: 0.375rem;
}
.message-row {
gap: 0.25rem;
}
}
@media (max-width: 280px) {
.username-section .username-input {
min-width: 0;
font-size: 0.625rem;
}
.settings-btn,
.send-btn {
width: 24px;
height: 24px;
min-width: 24px;
}
.settings-btn svg,
.send-btn svg {
width: 10px;
height: 10px;
}
.message-input {
font-size: 0.625rem;
min-width: 0;
}
}

210
public/css/moveableChat.css Normal file
View file

@ -0,0 +1,210 @@
.moveable-chat-frame {
position: fixed;
top: 20%;
right: 20px;
width: 350px;
height: 500px;
background: var(--bg-card);
border-radius: 12px 12px 0 0;
box-shadow: var(--shadow-xl);
backdrop-filter: blur(20px);
z-index: 1000;
display: flex;
flex-direction: column;
overflow: hidden;
min-width: 280px;
min-height: 200px;
max-width: 90vw;
max-height: 90vh;
transition: all 0.3s ease;
}
.moveable-chat-frame.minimized {
height: 44px;
resize: none;
}
.moveable-chat-frame.minimized .chat-frame-content {
display: none;
}
.moveable-chat-frame.minimized .resize-handle {
display: none;
}
.chat-frame-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-bottom: none;
cursor: move;
user-select: none;
border-radius: 12px 12px 0 0;
flex-shrink: 0;
}
.chat-frame-title {
display: flex;
align-items: center;
gap: 8px;
color: var(--text-primary);
font-weight: 600;
font-size: 14px;
}
.chat-frame-title svg {
color: var(--accent-blue);
}
.chat-frame-controls {
display: flex;
gap: 4px;
}
.chat-control-btn {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: none;
border: none;
border-radius: 4px;
color: var(--text-secondary);
cursor: pointer;
transition: all 0.2s ease;
}
.chat-control-btn:hover {
background: var(--bg-primary);
color: var(--text-primary);
}
.chat-frame-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--border-primary);
border-top: none;
border-radius: 0;
}
.chat-frame-iframe {
width: 100%;
height: 100%;
border: none;
background: var(--bg-card);
}
.resize-handle {
position: absolute;
background: transparent;
z-index: 10;
}
.resize-handle-n,
.resize-handle-s {
left: 0;
right: 0;
height: 4px;
cursor: ns-resize;
}
.resize-handle-n {
top: 0;
}
.resize-handle-s {
bottom: 0;
}
.resize-handle-e,
.resize-handle-w {
top: 0;
bottom: 0;
width: 4px;
cursor: ew-resize;
}
.resize-handle-e {
right: 0;
}
.resize-handle-w {
left: 0;
}
.resize-handle-ne,
.resize-handle-nw,
.resize-handle-se,
.resize-handle-sw {
width: 8px;
height: 8px;
}
.resize-handle-ne {
top: 0;
right: 0;
cursor: ne-resize;
}
.resize-handle-nw {
top: 0;
left: 0;
cursor: nw-resize;
}
.resize-handle-se {
bottom: 0;
right: 0;
cursor: se-resize;
}
.resize-handle-sw {
bottom: 0;
left: 0;
cursor: sw-resize;
}
.chat-open #toggleChatBtn {
background: var(--accent-blue);
color: white;
}
@media (max-width: 768px) {
.moveable-chat-frame {
width: calc(100vw - 20px);
height: 60vh;
right: 10px;
left: 10px;
top: auto;
bottom: 10px;
border-radius: 12px 12px 0 0;
}
.moveable-chat-frame.minimized {
height: 44px;
bottom: 10px;
}
.resize-handle {
display: none;
}
}
.chat-frame-loading {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
color: var(--text-secondary);
font-size: 14px;
}
.chat-frame-loading .spinner {
width: 20px;
height: 20px;
margin-right: 8px;
}

View file

@ -22,12 +22,14 @@
--accent-red: #f85149;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px
rgba(0, 0, 0, 0.3);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px
rgba(0, 0, 0, 0.3);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px
rgba(0, 0, 0, 0.3);
}
* {
box-sizing: border-box;
margin: 0;