mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 16:22:18 +00:00
786f4807b3
## Description: Move these assets to files so that they can be replaced with generated assets in the future. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
84 lines
1.9 KiB
TypeScript
84 lines
1.9 KiB
TypeScript
import { LitElement, css, html } from "lit";
|
|
import { resolveMarkdown } from "lit-markdown";
|
|
import { customElement, property, query } from "lit/decorators.js";
|
|
import { translateText } from "../client/Utils";
|
|
import "./components/baseComponents/Button";
|
|
import "./components/baseComponents/Modal";
|
|
|
|
@customElement("news-modal")
|
|
export class NewsModal extends LitElement {
|
|
@query("o-modal") private modalEl!: HTMLElement & {
|
|
open: () => void;
|
|
close: () => void;
|
|
};
|
|
|
|
@property({ type: String }) markdown = "Loading...";
|
|
|
|
static styles = css`
|
|
:host {
|
|
display: block;
|
|
}
|
|
|
|
.news-container {
|
|
max-height: 60vh;
|
|
overflow-y: auto;
|
|
padding: 1rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.news-content {
|
|
color: #ddd;
|
|
line-height: 1.5;
|
|
background: rgba(0, 0, 0, 0.6);
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
}
|
|
|
|
.news-content a {
|
|
color: #4a9eff !important;
|
|
text-decoration: underline !important;
|
|
transition: color 0.2s ease;
|
|
}
|
|
|
|
.news-content a:hover {
|
|
color: #6fb3ff !important;
|
|
}
|
|
`;
|
|
|
|
render() {
|
|
return html`
|
|
<o-modal title=${translateText("news.title")}>
|
|
<div class="options-layout">
|
|
<div class="options-section">
|
|
<div class="news-container">
|
|
<div class="news-content">
|
|
${resolveMarkdown(this.markdown, {
|
|
includeImages: true,
|
|
includeCodeBlockClassNames: true,
|
|
})}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<o-button
|
|
title=${translateText("common.close")}
|
|
@click=${this.close}
|
|
blockDesktop
|
|
></o-button>
|
|
</o-modal>
|
|
`;
|
|
}
|
|
|
|
public open() {
|
|
this.requestUpdate();
|
|
this.modalEl?.open();
|
|
}
|
|
|
|
private close() {
|
|
this.modalEl?.close();
|
|
}
|
|
}
|