15};
16
17export default async function(interval: Interval) {
18 const reminders = (await blob.getJSON(`coffeetime.reminders`) as Array<{
19 name: string;
374
375// Main Component for the News Article Tab - Adapted to use inline styles and MediaMonitoringTab patterns
376export function NewsArticleTab({ user }) {
377 const [articles, setArticles] = useState([]);
378 const [title, setTitle] = useState("");
555 };
556
557 // Function to open the edit modal - Similar pattern to MediaMonitoringTab
558 const handleEditClick = (article) => {
559 // Assuming article properties match backend column names (e.g., main_idea, firstName, fatherName)
573 };
574
575 // Function to close the edit modal - Similar pattern to MediaMonitoringTab
576 const handleCloseEditModal = () => {
577 setIsEditModalOpen(false);
588 };
589
590 // Function to handle changes in the edit modal form - Similar pattern to MediaMonitoringTab
591 const handleEditFormChange = (e) => {
592 const { name, value } = e.target;
597 };
598
599 // Function to save the edited entry - Similar pattern to MediaMonitoringTab
600 const handleSaveEdit = async () => {
601 // Validate required fields from editFormData
1import { blob } from "https://esm.town/v/std/blob";
2
3export default async function(req: Request): Promise<Response> {
4 const token = req.headers.get("authorization")?.split(" ")?.at(1);
5
202};
203
204function WeeklyReportTab() {
205 // State for the detailed report (news and media)
206 const [detailedReport, setDetailedReport] = useState(null);
230 const [selectedAuthorName, setSelectedAuthorName] = useState("");
231
232 // Function to fetch the detailed report
233 const fetchDetailedReport = async () => {
234 // setWeeklySummary(null); // REMOVED: Don't clear summary when fetching detailed
244 };
245
246 // Function to fetch the weekly summary report
247 const fetchWeeklySummary = async () => {
248 // setDetailedReport(null); // REMOVED: Don't clear detailed when fetching summary
332 }, [weeklySummary]);
333
334 // Function to handle click on author name in Weekly Summary
335 const handleAuthorClick = (authorName) => {
336 // Now detailedReport is NOT cleared when switching to summary,
352 };
353
354 // Function to close the author detail modal
355 const handleCloseAuthorDetailModal = () => {
356 setIsAuthorDetailModalOpen(false);
359 };
360
361 // Helper function for CSV export (only for detailed report)
362 const exportToCSV = (data, filename) => {
363 if (!data || data.length === 0) {
68 };
69
70 // Function to reset all form fields
71 const resetForm = () => {
72 setEmployeeId("");
1import { useEffect } from "https://esm.sh/react@18.2.0?dev";
2
3export function useUsageStats (messages: any[], usages: any[]) {
4 useEffect(() => {
5 if (!messages?.length) return;
7 *
8 * @param {Array} dependencies - Array of dependencies that trigger scrolling when changed
9 * @returns {Object} An object containing containerRef and scrollToBottom function
10 */
11export function useScrollToBottomContainer(dependencies = []) {
12 const containerRef = useRef(null);
13
28
29// body scroll version
30export function useScrollToBottom(dependencies = []) {
31 const bottomRef = useRef(null);
32
6 * This includes a fallback to inference calls data when usage data is missing
7 */
8export async function getUserSummary() {
9 // First, get the standard grouped data from the usage table
10 const groupedUsageData = await sqlite.execute(`
5const FILES_ENDPOINT = "/api/project-files";
6
7export function useProject (projectId: string, branchId?: string) {
8 const { token } = useAuth();
9 const [data, setData] = useState<any>(null);
4const ENDPOINT = "/api/projects-loader";
5
6export function useProjects () {
7 const { token } = useAuth();
8 const [data, setData] = useState<any>(null);
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.