Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65c38765c6 | ||
| 4ddd9bb220 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "flyer-crawler",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "flyer-crawler",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.2",
|
||||
"dependencies": {
|
||||
"@bull-board/api": "^6.14.2",
|
||||
"@bull-board/express": "^6.14.2",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "flyer-crawler",
|
||||
"private": true,
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "concurrently \"npm:start:dev\" \"vite\"",
|
||||
|
||||
@@ -216,7 +216,7 @@ describe('MainLayout Component', () => {
|
||||
});
|
||||
|
||||
it('does not show the AnonymousUserBanner if there are no flyers', () => {
|
||||
mockedUseFlyers.mockReturnValueOnce({ ...defaultUseFlyersReturn, flyers: [] });
|
||||
mockedUseFlyers.mockReturnValue({ ...defaultUseFlyersReturn, flyers: [] });
|
||||
renderWithRouter(<MainLayout {...defaultProps} />);
|
||||
expect(screen.queryByTestId('anonymous-banner')).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -239,7 +239,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
describe('Error Handling', () => {
|
||||
it('displays an error message if useData has an error', () => {
|
||||
mockedUseFlyers.mockReturnValueOnce({
|
||||
mockedUseFlyers.mockReturnValue({
|
||||
...defaultUseFlyersReturn,
|
||||
flyersError: new Error('Data Fetch Failed'),
|
||||
});
|
||||
@@ -248,7 +248,7 @@ describe('MainLayout Component', () => {
|
||||
});
|
||||
|
||||
it('displays an error message if useShoppingLists has an error', () => {
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
error: 'Shopping List Failed',
|
||||
});
|
||||
@@ -257,7 +257,7 @@ describe('MainLayout Component', () => {
|
||||
});
|
||||
|
||||
it('displays an error message if useMasterItems has an error', () => {
|
||||
mockedUseMasterItems.mockReturnValueOnce({
|
||||
mockedUseMasterItems.mockReturnValue({
|
||||
...defaultUseMasterItemsReturn,
|
||||
error: 'Master Items Failed',
|
||||
});
|
||||
@@ -266,7 +266,7 @@ describe('MainLayout Component', () => {
|
||||
});
|
||||
|
||||
it('displays an error message if useWatchedItems has an error', () => {
|
||||
mockedUseWatchedItems.mockReturnValueOnce({
|
||||
mockedUseWatchedItems.mockReturnValue({
|
||||
...defaultUseWatchedItemsReturn,
|
||||
error: 'Watched Items Failed',
|
||||
});
|
||||
@@ -275,7 +275,7 @@ describe('MainLayout Component', () => {
|
||||
});
|
||||
|
||||
it('displays an error message if useActiveDeals has an error', () => {
|
||||
mockedUseActiveDeals.mockReturnValueOnce({
|
||||
mockedUseActiveDeals.mockReturnValue({
|
||||
...defaultUseActiveDealsReturn,
|
||||
error: 'Active Deals Failed',
|
||||
});
|
||||
@@ -286,7 +286,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
describe('Event Handlers', () => {
|
||||
it('calls setActiveListId when a list is shared via ActivityLog and the list exists', () => {
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
shoppingLists: [
|
||||
createMockShoppingList({ shopping_list_id: 1, name: 'My List', user_id: 'user-123' }),
|
||||
@@ -318,7 +318,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
it('calls addItemToList when an item is added from ShoppingListComponent and a list is active', () => {
|
||||
const mockAddItemToList = vi.fn();
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
activeListId: 1,
|
||||
addItemToList: mockAddItemToList,
|
||||
@@ -332,7 +332,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
it('does not call addItemToList from ShoppingListComponent if no list is active', () => {
|
||||
const mockAddItemToList = vi.fn();
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
activeListId: null,
|
||||
addItemToList: mockAddItemToList,
|
||||
@@ -346,7 +346,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
it('calls addItemToList when an item is added from WatchedItemsList and a list is active', () => {
|
||||
const mockAddItemToList = vi.fn();
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
activeListId: 5,
|
||||
addItemToList: mockAddItemToList,
|
||||
@@ -360,7 +360,7 @@ describe('MainLayout Component', () => {
|
||||
|
||||
it('does not call addItemToList from WatchedItemsList if no list is active', () => {
|
||||
const mockAddItemToList = vi.fn();
|
||||
mockedUseShoppingLists.mockReturnValueOnce({
|
||||
mockedUseShoppingLists.mockReturnValue({
|
||||
...defaultUseShoppingListsReturn,
|
||||
activeListId: null,
|
||||
addItemToList: mockAddItemToList,
|
||||
|
||||
@@ -94,6 +94,9 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
|
||||
watchedItemsError ||
|
||||
activeDealsError;
|
||||
|
||||
// Only show banner for unauthenticated users when there are flyers to view
|
||||
const shouldShowBanner = authStatus === 'SIGNED_OUT' && flyers.length > 0;
|
||||
|
||||
return (
|
||||
<main className="max-w-screen-2xl mx-auto py-4 px-2.5 sm:py-6 lg:py-8">
|
||||
<Joyride
|
||||
@@ -112,10 +115,8 @@ export const MainLayout: React.FC<MainLayoutProps> = ({
|
||||
},
|
||||
}}
|
||||
/>
|
||||
{authStatus === 'SIGNED_OUT' && flyers.length > 0 && (
|
||||
{shouldShowBanner && (
|
||||
<div className="max-w-5xl mx-auto mb-6 px-4 lg:px-0">
|
||||
{' '}
|
||||
{/* This div was missing a closing tag in the original code, but it's outside the diff scope. */}
|
||||
<AnonymousUserBanner onOpenProfile={onOpenProfile} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user