Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AmolSoans committed Dec 9, 2024
1 parent b0ec51a commit 016fa46
Show file tree
Hide file tree
Showing 5 changed files with 1,038 additions and 59 deletions.
41 changes: 19 additions & 22 deletions background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,30 @@ const CACHE_CONFIG = {
maxItems: 500 // Limit cache size
};
const supabase = createClient(
'YOUR_SUPABASE_URL',
'YOUR_SUPABASE_ANON_KEY'


)
// Initialize extension
chrome.runtime.onInstalled.addListener(async () => {
console.log('Trade Call Widget installed/updated');
await initializeCache();
await cacheAllStockSymbols(); // Cache stock symbols on installation
await checkAuth();
//await initializeCache();
//await cacheAllStockSymbols(); // Cache stock symbols on installation
//await checkAuth();
await chrome.sidePanel.setOptions({
enabled: true,
path: 'popup.html'
});
});

// Check auth state when extension opens
chrome.runtime.onStartup.addListener(async() => {
await checkAuth();
// await checkAuth();
console.log('on startup checked auth')
});

async function checkAuth() {
const { data: { session }, error } = await supabase.auth.getSession();

console.log('checking auth')
if (error || !session) {
// If not authenticated, open auth popup
chrome.windows.create({
Expand Down Expand Up @@ -69,21 +74,13 @@ async function cacheAllStockSymbols() {

// Listen for extension icon clicks
chrome.action.onClicked.addListener(async (tab) => {
// Open the side panel in the current window
await chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true })
.catch((error) => console.error(error));
});


chrome.sidePanel
.setPanelBehavior({ openPanelOnActionClick: true })
.catch((error) => console.error(error));
// Initialize side panel options when extension is installed or updated
chrome.runtime.onInstalled.addListener(async () => {
await chrome.sidePanel.setOptions({
enabled: true,
path: 'popup.html'
});
console.log('Extension icon clicked'); // Log when the icon is clicked
try {
await chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true });
console.log('Side panel behavior set successfully');
} catch (error) {
console.error('Error setting side panel behavior:', error);
}
});

// Handle messages from popup
Expand Down
2 changes: 1 addition & 1 deletion src/components/atoms/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Button = ({
}) => {
const progress = totalFields > 0 ? (validFields / totalFields) * 100 : 0;
//const isEnabled = progress === 100;
const isEnabled = (type === 'reset' || 'update' ? true : (progress === 100))
const isEnabled = (type === 'reset' || type === 'update' || progress === 100);

// Button type styles
const typeStyles = {
Expand Down
Loading

0 comments on commit 016fa46

Please sign in to comment.