feat: add Ollama icon and modern chat UI styling
- src/chat-view.ts: Add getIcon() returning 'bot' for the view tab icon.
Improve render() with role-specific CSS classes (user vs assistant) and
message header structure for better styling hooks.
- src/main.ts: Add ribbon icon ('bot') in the left sidebar that opens the
chat view with a single click.
- styles.css (new): Modern chat UI with message bubbles, distinct user and
assistant themes using Obsidian CSS variables, sticky input bar, styled
send button with accent color, and emoji role indicators.
- install.sh: Copy styles.css into the plugin directory and verify its
presence during installation.
- README.md: Include styles.css in manual install instructions.
- __mocks__/obsidian.ts: Add addRibbonIcon() mock for test compatibility.
- tests/chat-view.test.ts: Add getIcon() assertion.
This commit is contained in:
+151
@@ -0,0 +1,151 @@
|
||||
:root {
|
||||
--ollama-user-bg: var(--background-modifier-form-field);
|
||||
--ollama-assistant-bg: var(--background-primary-alt);
|
||||
--ollama-border: var(--background-modifier-border);
|
||||
--ollama-radius: var(--radius-m);
|
||||
--ollama-gap: var(--size-4-2);
|
||||
}
|
||||
|
||||
.ollama-chat-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ollama-gap);
|
||||
padding: var(--size-4-2);
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.ollama-message {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--size-4-1);
|
||||
padding: var(--size-4-2);
|
||||
border-radius: var(--ollama-radius);
|
||||
border: 1px solid var(--ollama-border);
|
||||
max-width: 90%;
|
||||
}
|
||||
|
||||
.ollama-message-user {
|
||||
align-self: flex-end;
|
||||
background-color: var(--ollama-user-bg);
|
||||
}
|
||||
|
||||
.ollama-message-assistant {
|
||||
align-self: flex-start;
|
||||
background-color: var(--ollama-assistant-bg);
|
||||
}
|
||||
|
||||
.ollama-message-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--size-4-1);
|
||||
font-size: var(--font-smallest);
|
||||
font-weight: var(--font-semibold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ollama-message-role::before {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-right: var(--size-4-1);
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ollama-message-user .ollama-message-role::before {
|
||||
content: '👤';
|
||||
}
|
||||
|
||||
.ollama-message-assistant .ollama-message-role::before {
|
||||
content: '🤖';
|
||||
}
|
||||
|
||||
.ollama-message-content {
|
||||
line-height: var(--line-height-normal);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.ollama-new-chat-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: var(--size-4-1) var(--size-4-2);
|
||||
}
|
||||
|
||||
.ollama-new-chat-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--size-4-1);
|
||||
padding: var(--size-4-1) var(--size-4-2);
|
||||
font-size: var(--font-smallest);
|
||||
border-radius: var(--ollama-radius);
|
||||
border: 1px solid var(--ollama-border);
|
||||
background-color: var(--background-modifier-form-field);
|
||||
color: var(--text-normal);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.ollama-new-chat-button:hover {
|
||||
background-color: var(--background-modifier-hover);
|
||||
}
|
||||
|
||||
.ollama-new-chat-button::before {
|
||||
content: '➕';
|
||||
}
|
||||
|
||||
.ollama-input-container {
|
||||
display: flex;
|
||||
gap: var(--size-4-1);
|
||||
padding: var(--size-4-2);
|
||||
border-top: 1px solid var(--ollama-border);
|
||||
background-color: var(--background-primary);
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.ollama-input {
|
||||
flex: 1;
|
||||
min-height: 2.5rem;
|
||||
max-height: 8rem;
|
||||
padding: var(--size-4-1) var(--size-4-2);
|
||||
border-radius: var(--ollama-radius);
|
||||
border: 1px solid var(--ollama-border);
|
||||
background-color: var(--background-modifier-form-field);
|
||||
color: var(--text-normal);
|
||||
resize: vertical;
|
||||
font-family: inherit;
|
||||
font-size: var(--font-ui-small);
|
||||
line-height: var(--line-height-normal);
|
||||
}
|
||||
|
||||
.ollama-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--interactive-accent);
|
||||
box-shadow: 0 0 0 2px var(--interactive-accent-translucent);
|
||||
}
|
||||
|
||||
.ollama-send-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--size-4-1) var(--size-4-3);
|
||||
border-radius: var(--ollama-radius);
|
||||
border: none;
|
||||
background-color: var(--interactive-accent);
|
||||
color: var(--text-on-accent);
|
||||
font-weight: var(--font-semibold);
|
||||
font-size: var(--font-ui-small);
|
||||
cursor: pointer;
|
||||
transition: filter 0.15s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ollama-send-button:hover {
|
||||
filter: brightness(1.1);
|
||||
}
|
||||
|
||||
.ollama-send-button:active {
|
||||
filter: brightness(0.95);
|
||||
}
|
||||
Reference in New Issue
Block a user