Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 64 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
# CIS 3500: Nara Extension Starter

## Overview
This assignment involves enhancing a Chrome extension developed by one of the Top 3 winners of the MCIT hackathon. The project provides hands-on experience in web development, API integration, and collaborative coding.

**Original project:** [Nara](https://github.com/luyiZhang818/Nara-Chrome-Extension)

## Project Description
Nara is a Chrome extension that helps users manage their tasks and reminders efficiently. Your task is to enhance this extension by implementing new features.

## Enhancement Options
Choose one of the following enhancements to implement:

1. **Speech Bubble Encouragement**: Implement a feature where, whenever the user checks off a task, a speech or thought bubble appears near the deer with a short, encouraging message (e.g., “Great job!”, “You’re making progress!”, “Keep going!”).
2. **Daily Gratitude Log**: Implement a small text area where users can note one thing they’re grateful for each day. Over time, they can revisit a dedicated “gratitude log” to see their positive moments. Provide an interesting method to save these entries and display them on a separate screen so users can easily access their past entries.
3. **Mood Selection Prompt**: Implement a simple mood selection feature(e.g., happy, stressed, neutral) with a small icon or emoji. This allows users to log their emotional state quickly each day.
4. **Rotating Weekly Challenge**: Implement a weekly challenge system—such as “Drink 8 glasses of water each day” or “Take a 10-minute walk daily.” Users can check off these mini-challenges alongside their normal tasks for extra motivation.
5. **Inspirational Quote Overlay**: Implement a short inspirational quote or positive affirmation that appears on each new tab, displayed in a subtle text overlay.
6. **Implement a History Feature**: Maintain a log of all tasks and reminders created by the user, allowing them to revisit past items and track progress over time.
7. **Custom Feature**: Propose a unique feature (requires instructor/TA approval).

## Getting Started

### Step 1: Team Organization
- Assign a team member as the **Product Manager (PM)** for Nara.
- Ensure this PM is different from the one assigned to the Lunch Lotto project.

### Step 2: Repository Setup
The PM should fork the repository:
1. Navigate to the `nara-extension-starter` repository on GitHub.
2. Click the **Fork** button to create a copy under their account.

### Step 3: Cloning the Repository
Once the PM has forked the repository, team members should clone it locally:
```sh
git clone https://github.com/<PM-username>/nara-extension-starter.git
```

### Step 4: Development Workflow
1. Open the project in a text editor (e.g., **Visual Studio Code** recommended).
2. Make changes to the codebase.
3. Use the following commands to commit and push your changes:

```sh
git add .
git commit -m "feat: [feature name] added"
git push
```

4. As team members contribute, collaborate using **Pull Requests (PRs)** on GitHub.
5. Regularly sync your local repository with the latest changes:

```sh
git pull
```

6. Resolve merge conflicts as needed and ensure smooth integration.

## Submission
- Submit the final version of your project as per course guidelines.
- Include a brief write-up of your implemented features and any challenges faced.

---
Happy coding, and good luck with Nara! 🦌
# CIS 3500: Nara Extension Starter
## Overview
This assignment involves enhancing a Chrome extension developed by one of the Top 3 winners of the MCIT hackathon. The project provides hands-on experience in web development, API integration, and collaborative coding.
**Original project:** [Nara](https://github.com/luyiZhang818/Nara-Chrome-Extension)
## Project Description
Nara is a Chrome extension that helps users manage their tasks and reminders efficiently. Your task is to enhance this extension by implementing new features.
## Enhancement Options
Choose one of the following enhancements to implement:
1. **Speech Bubble Encouragement**: Implement a feature where, whenever the user checks off a task, a speech or thought bubble appears near the deer with a short, encouraging message (e.g., “Great job!”, “You’re making progress!”, “Keep going!”).
2. **Daily Gratitude Log**: Implement a small text area where users can note one thing they’re grateful for each day. Over time, they can revisit a dedicated “gratitude log” to see their positive moments. Provide an interesting method to save these entries and display them on a separate screen so users can easily access their past entries.
3. **Mood Selection Prompt**: Implement a simple mood selection feature(e.g., happy, stressed, neutral) with a small icon or emoji. This allows users to log their emotional state quickly each day.
4. **Rotating Weekly Challenge**: Implement a weekly challenge system—such as “Drink 8 glasses of water each day” or “Take a 10-minute walk daily.” Users can check off these mini-challenges alongside their normal tasks for extra motivation.
5. **Inspirational Quote Overlay**: Implement a short inspirational quote or positive affirmation that appears on each new tab, displayed in a subtle text overlay.
6. **Implement a History Feature**: Maintain a log of all tasks and reminders created by the user, allowing them to revisit past items and track progress over time.
7. **Custom Feature**: Propose a unique feature (requires instructor/TA approval).
## Getting Started
### Step 1: Team Organization
- Assign a team member as the **Product Manager (PM)** for Nara.
- Ensure this PM is different from the one assigned to the Lunch Lotto project.
### Step 2: Repository Setup
The PM should fork the repository:
1. Navigate to the `nara-extension-starter` repository on GitHub.
2. Click the **Fork** button to create a copy under their account.
### Step 3: Cloning the Repository
Once the PM has forked the repository, team members should clone it locally:
```sh
git clone https://github.com/<PM-username>/nara-extension-starter.git
```
### Step 4: Development Workflow
1. Open the project in a text editor (e.g., **Visual Studio Code** recommended).
2. Make changes to the codebase.
3. Use the following commands to commit and push your changes:
```sh
git add .
git commit -m "feat: [feature name] added"
git push
```
4. As team members contribute, collaborate using **Pull Requests (PRs)** on GitHub.
5. Regularly sync your local repository with the latest changes:
```sh
git pull
```
6. Resolve merge conflicts as needed and ensure smooth integration.
## Submission
- Submit the final version of your project as per course guidelines.
- Include a brief write-up of your implemented features and any challenges faced.
---
Happy coding, and good luck with Nara! 🦌
113 changes: 57 additions & 56 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
// Set up the daily reset alarm at 12:00 a.m.
chrome.runtime.onInstalled.addListener(() => {
setMidnightAlarm();
});

chrome.runtime.onStartup.addListener(() => {
setMidnightAlarm();
});

// Handle alarms for resetting state
chrome.alarms.onAlarm.addListener((alarm) => {
// Set up the daily reset alarm at 12:00 a.m.
chrome.runtime.onInstalled.addListener(() => {
setMidnightAlarm();
});
chrome.runtime.onStartup.addListener(() => {
setMidnightAlarm();
});
// Handle alarms for resetting state
chrome.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === "dailyReset") {
chrome.storage.local.set({ state: null }, () => {
console.log("State reset at 12:00 a.m.");
// Reset daily state and mood
chrome.storage.local.set({ state: null, mood: null }, () => {
console.log("State and mood reset at 12:00 a.m.");
});
setMidnightAlarm(); // Reset the alarm for the next day
}
});

// Function to set an alarm for 12:00 a.m.
function setMidnightAlarm() {
const now = new Date();
const midnight = new Date();
midnight.setHours(24, 0, 0, 0);

const timeUntilMidnight = (midnight - now) / (1000 * 60);
chrome.alarms.create("dailyReset", { delayInMinutes: timeUntilMidnight });
}

// Handle messages from newTab.js for generating subtasks
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === "generateSubtasks") {
// Call GPT wrapper
fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer API_TOKEN", // tbu
},
body: JSON.stringify({
prompt: `Break down the task "${message.task}" into 5 subtasks.`,
max_tokens: 100,
}),
})
.then((response) => response.json())
.then((data) => {
const subtasks = data.choices[0].text
.trim()
.split("\n")
.filter(Boolean);
chrome.runtime.sendMessage({ action: "updateSubtasks", subtasks });
})
.catch((error) => {
console.error("Error generating subtasks:", error);
});
return true; // Keep the message channel open for async response
}
});
setMidnightAlarm(); // Reset the alarm for the next day
}
});
// Function to set an alarm for 12:00 a.m.
function setMidnightAlarm() {
const now = new Date();
const midnight = new Date();
midnight.setHours(24, 0, 0, 0);
const timeUntilMidnight = (midnight - now) / (1000 * 60);
chrome.alarms.create("dailyReset", { delayInMinutes: timeUntilMidnight });
}
// Handle messages from newTab.js for generating subtasks
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.action === "generateSubtasks") {
// Call GPT wrapper
fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer API_TOKEN", // tbu
},
body: JSON.stringify({
prompt: `Break down the task "${message.task}" into 5 subtasks.`,
max_tokens: 100,
}),
})
.then((response) => response.json())
.then((data) => {
const subtasks = data.choices[0].text
.trim()
.split("\n")
.filter(Boolean);
chrome.runtime.sendMessage({ action: "updateSubtasks", subtasks });
})
.catch((error) => {
console.error("Error generating subtasks:", error);
});
return true; // Keep the message channel open for async response
}
});
46 changes: 23 additions & 23 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"manifest_version": 3,
"name": "Nara",
"description": "Chrome extension to manage tasks and subtasks with GPT.",
"version": "1.0",
"permissions": ["storage", "alarms"],
"background": {
"service_worker": "background.js"
},
"chrome_url_overrides": {
"newtab": "newTab.html"
},
"icons": {
"48": "assets/icon48.png",
"128": "assets/icon128.png"
},
"web_accessible_resources": [
{
"resources": ["scripts/Sortable.min.js"],
"matches": ["<all_urls>"]
}
]
}
{
"manifest_version": 3,
"name": "Nara",
"description": "Chrome extension to manage tasks and subtasks with GPT.",
"version": "1.0",
"permissions": ["storage", "alarms"],
"background": {
"service_worker": "background.js"
},
"chrome_url_overrides": {
"newtab": "newTab.html"
},
"icons": {
"48": "assets/icon48.png",
"128": "assets/icon128.png"
},
"web_accessible_resources": [
{
"resources": ["scripts/Sortable.min.js"],
"matches": ["<all_urls>"]
}
]
}
Loading