5import { LoginWithGoogleButton } from "https://esm.town/v/stevekrouse/LoginWithGoogleButton";
67function App({ initialEmail }) {
8const [email, setEmail] = useState(initialEmail);
940}
4142function client() {
43const initialEmail = document.getElementById('root').dataset.email;
44createRoot(document.getElementById("root")).render(<App initialEmail={initialEmail} />);
49}
5051async function handler(request: Request): Promise<Response> {
52const url = new URL(request.url);
53const email = request.headers.get("X-LastLogin-Email");
telegramWebhookEchoMessageOLDmain.tsx17 matches
47};
4849async function handleMessage(message) {
50const userMessage = message.text;
51const chatId = message.chat.id;
62}
6364async function processUserInputWithAI(userMessage: string, tasks: Task[], state: UserState): Promise<{ response: string, updatedTasks: Task[], updatedState: UserState, suggestedActions: string[] }> {
65const taskListString = JSON.stringify(tasks);
66const stateString = JSON.stringify(state);
78Based on the user's message and the conversation context, determine the appropriate action to take and execute it.
79Be proactive in guiding the user through their tasks, focusing on prioritization and breaking down tasks into microsteps.
80You can use the following functions:
81- addTask(tasks: Task[], title: string): Adds a new task
82- markTaskAsDone(tasks: Task[], taskId: string): Marks a task as done
138}
139140function addTask(tasks: Task[], title: string) {
141const newTask: Task = {
142id: Date.now().toString(),
150}
151152function markTaskAsDone(tasks: Task[], taskId: string) {
153const task = findTask(tasks, taskId);
154if (task) {
157}
158159function breakDownTask(tasks: Task[], taskId: string, subtasks: string[]) {
160const task = findTask(tasks, taskId);
161if (task) {
175}
176177function findTask(tasks: Task[], taskId: string): Task | null {
178return tasks.find(task => task.id === taskId) || null;
179}
180181function compareTaskPriorities(tasks: Task[], taskId1: string, taskId2: string) {
182const task1 = findTask(tasks, taskId1);
183const task2 = findTask(tasks, taskId2);
191}
192193function suggestMicrosteps(taskTitle: string): string[] {
194// This function would ideally use AI to generate suggestions, but for simplicity, we'll return static suggestions
195return ["Get materials", "Prepare workspace", "Start first step"];
196}
197198function navigateTaskHierarchy(tasks: Task[], currentTaskId: string | null, direction: 'up' | 'down' | 'next' | 'prev'): string | null {
199if (!currentTaskId) return null;
200const currentTask = findTask(tasks, currentTaskId);
217}
218219function generateTaskList(tasks: Task[], showCompleted: boolean, parentId: string | null = null, indent = ''): string {
220let list = '';
221const currentLevelTasks = tasks.filter(task => task.parent_id === parentId && (showCompleted || !task.done));
231}
232233async function sendResponse(chatId: number, message: string, suggestedActions: string[]) {
234const keyboard = [
235...suggestedActions.map(action => [{ text: action }]),
254}
255256async function getTasks(chatId: number): Promise<Task[]> {
257const key = `tasks_${chatId}`;
258try {
265}
266267async function updateTasks(chatId: number, tasks: Task[]) {
268const key = `tasks_${chatId}`;
269try {
274}
275276async function getUserState(chatId: number): Promise<UserState> {
277const key = `state_${chatId}`;
278try {
285}
286287async function updateUserState(chatId: number, state: UserState) {
288const key = `state_${chatId}`;
289try {
switchbot_partymain.tsx8 matches
37];
3839function getPartyStatus() {
40const now = Temporal.Now.zonedDateTimeISO(NYC_TIMEZONE);
41for (const party of parties) {
53}
5455function formatTimeDifference(target, now) {
56const diff = target.since(now);
57const hours = diff.hours;
65}
6667async function switchbotRequest(path, args) {
68const token = Deno.env.get("SWITCHBOT_TOKEN");
69const secret = Deno.env.get("SWITCHBOT_KEY");
89}
9091function botPress(device) {
92return switchbotRequest(`v1.1/devices/${device}/commands`, {
93method: "POST",
102const { htmlUrl } = extractValInfo(import.meta.url);
103104function Layout({ children, title }) {
105return (
106<html>
122}
123124function Button({ children }) {
125return (
126<button class="bg-green-500 hover:bg-green-600 text-white font-bold py-3 px-6 rounded-full shadow-lg transform transition duration-200 hover:scale-105 focus:outline-none focus:ring-2 focus:ring-green-400 focus:ring-opacity-50">
130}
131132function MainPage({ partyName }) {
133return (
134<Layout title={partyName}>
147}
148149function ErrorPage({ title, message, backLink = true }) {
150return (
151<Layout title={title}>
selfDestructmain.tsx1 match
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
34export async function selfDestruct(importMetaUrl: string) {
5const { id } = await fetchValInfo(importMetaUrl);
6const { vals } = new ValTown();
fetchValInfomain.tsx1 match
2import ValTown from "npm:@valtown/sdk";
34export function fetchValInfo(importMetaURL: string) {
5const vt = new ValTown();
6const { author, name } = extractValInfo(importMetaURL);
1# getMyValId
23Helper function for a val to get its own ID.
45## Usage
2import ValTown from "npm:@valtown/sdk";
34async function getMyValId(importMetaURL: string) {
5const vt = new ValTown();
6const { author, name } = extractValInfo(importMetaURL);
getMyValIdmain.tsx1 match
2import ValTown from "npm:@valtown/sdk";
34async function getMyValId(importMetaURL: string) {
5const vt = new ValTown();
6const { author, name } = extractValInfo(importMetaURL);
getMyValIdREADME.md1 match
1# getMyValId
23Helper function for a val to get its own ID.
45## Usage
1import { DOMParser } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";
23export default async function scrapeBookMyShow() {
4const url = "https://in.bookmyshow.com/explore/home/mumbai"; // Example URL, you may need to adjust this
5const response = await fetch(url, {