@armoyu/ui 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/api/proxy/[...path]/route.d.ts +22 -0
- package/dist/app/api/proxy/[...path]/route.d.ts.map +1 -0
- package/dist/app/api/proxy/[...path]/route.js +89 -0
- package/dist/app/api/proxy/[...path]/route.js.map +1 -0
- package/dist/app/layout.js +11 -11
- package/dist/components/Button.d.ts +7 -7
- package/dist/components/Button.js +15 -15
- package/dist/components/GenderStatsBar.d.ts +5 -5
- package/dist/components/GenderStatsBar.js +7 -7
- package/dist/components/RollingNumber.d.ts +6 -6
- package/dist/components/RollingNumber.js +23 -23
- package/dist/components/Slider.d.ts +10 -10
- package/dist/components/Slider.js +35 -35
- package/dist/components/StatsGrid.js +13 -13
- package/dist/components/ViewModeToggle.d.ts +7 -7
- package/dist/components/ViewModeToggle.js +9 -9
- package/dist/components/modules/auth/Dashboard.js +250 -250
- package/dist/components/modules/auth/MediaLightbox.d.ts +13 -13
- package/dist/components/modules/auth/MediaLightbox.js +46 -46
- package/dist/components/modules/auth/PostCard.js +112 -112
- package/dist/components/modules/auth/PostInteractionsModal.js +12 -12
- package/dist/components/modules/auth/RepostModal.js +75 -75
- package/dist/components/modules/auth/SidebarLeft.js +40 -40
- package/dist/components/modules/auth/Stories.js +15 -15
- package/dist/components/modules/auth/StoryViewer.js +47 -47
- package/dist/components/modules/chat/ChatContainer.js +196 -196
- package/dist/components/modules/chat/ChatInput.js +30 -30
- package/dist/components/modules/chat/ChatList.js +51 -51
- package/dist/components/modules/chat/ChatMessage.d.ts +11 -11
- package/dist/components/modules/chat/ChatMessage.js +6 -6
- package/dist/components/modules/chat/ChatNotes.js +11 -11
- package/dist/components/modules/community/GroupHeader.js +17 -17
- package/dist/components/modules/community/GroupMenu.js +16 -16
- package/dist/components/modules/community/SchoolCard.js +7 -7
- package/dist/components/modules/community/SurveyCard.js +35 -35
- package/dist/components/modules/forum/ForumBoard.d.ts +16 -16
- package/dist/components/modules/forum/ForumBoard.js +6 -6
- package/dist/components/modules/forum/ForumPost.d.ts +13 -13
- package/dist/components/modules/forum/ForumPost.js +5 -5
- package/dist/components/modules/forum/NewTopicModal.d.ts +7 -7
- package/dist/components/modules/forum/NewTopicModal.js +26 -26
- package/dist/components/modules/forum/TopicItem.d.ts +15 -15
- package/dist/components/modules/forum/TopicItem.js +6 -6
- package/dist/components/modules/galleries/GalleryCard.d.ts +9 -9
- package/dist/components/modules/galleries/GalleryCard.js +5 -5
- package/dist/components/modules/giveaways/GiveawayCard.d.ts +9 -9
- package/dist/components/modules/giveaways/GiveawayCard.js +6 -6
- package/dist/components/modules/groups/ApplicationModal.d.ts +7 -7
- package/dist/components/modules/groups/ApplicationModal.js +27 -27
- package/dist/components/modules/groups/GroupCard.d.ts +12 -12
- package/dist/components/modules/groups/GroupCard.js +6 -6
- package/dist/components/modules/guest/Introduction.js +13 -13
- package/dist/components/modules/magaza/BackToStore.js +10 -10
- package/dist/components/modules/magaza/StoreHeader.js +8 -8
- package/dist/components/modules/news/NewsCard.js +6 -6
- package/dist/components/modules/news/NewsComments.js +52 -52
- package/dist/components/modules/profile/CloudStorageModal.d.ts +8 -8
- package/dist/components/modules/profile/CloudStorageModal.js +31 -31
- package/dist/components/modules/profile/EditProfileModal.d.ts +8 -8
- package/dist/components/modules/profile/EditProfileModal.js +27 -27
- package/dist/components/modules/profile/ProfileContent.js +70 -70
- package/dist/components/modules/profile/ProfileHeader.js +19 -19
- package/dist/components/modules/profile/ProfileStats.d.ts +1 -1
- package/dist/components/modules/profile/ProfileStats.js +14 -14
- package/dist/components/modules/profile/TeamSelectorModal.js +16 -16
- package/dist/components/modules/stations/StationCard.js +25 -25
- package/dist/components/modules/stations/StationQRModal.js +12 -12
- package/dist/components/shared/FloatingChatButton.js +20 -20
- package/dist/components/shared/Footer.d.ts +1 -1
- package/dist/components/shared/Footer.js +9 -9
- package/dist/components/shared/Header.js +97 -97
- package/dist/components/shared/LoginModal.d.ts.map +1 -1
- package/dist/components/shared/LoginModal.js +12 -16
- package/dist/components/shared/LoginModal.js.map +1 -1
- package/dist/components/shared/MainLayoutWrapper.js +7 -7
- package/dist/components/shared/PageWidth.d.ts +5 -5
- package/dist/components/shared/PageWidth.js +13 -13
- package/dist/components/showcase/SocialTab.d.ts.map +1 -1
- package/dist/components/showcase/SocialTab.js +47 -2
- package/dist/components/showcase/SocialTab.js.map +1 -1
- package/dist/context/AuthContext.d.ts +1 -1
- package/dist/context/AuthContext.d.ts.map +1 -1
- package/dist/context/AuthContext.js +52 -33
- package/dist/context/AuthContext.js.map +1 -1
- package/dist/context/CartContext.js +63 -63
- package/dist/context/ChatContext.d.ts +12 -12
- package/dist/context/ChatContext.js +17 -17
- package/dist/context/LayoutContext.d.ts +10 -10
- package/dist/context/LayoutContext.js +16 -16
- package/dist/context/SocketContext.js +30 -30
- package/dist/context/ThemeContext.d.ts +10 -10
- package/dist/context/ThemeContext.js +39 -39
- package/dist/index.js +80 -80
- package/dist/lib/constants/educationData.js +117 -117
- package/dist/lib/constants/punishmentData.d.ts +29 -29
- package/dist/lib/constants/punishmentData.js +183 -183
- package/dist/lib/constants/seedData.js +694 -694
- package/dist/lib/constants/stationData.js +166 -166
- package/dist/lib/constants/surveyData.js +49 -49
- package/dist/lib/constants/teamData.js +65 -65
- package/dist/types/stats.d.ts +17 -17
- package/dist/types/stats.js +1 -1
- package/package.json +47 -46
- package/src/globals.css +187 -187
- package/next.config.ts +0 -13
- package/postcss.config.js +0 -6
- package/src/app/layout.tsx +0 -64
- package/src/app/page.tsx +0 -101
- package/src/components/Button.tsx +0 -41
- package/src/components/GenderStatsBar.tsx +0 -66
- package/src/components/RollingNumber.tsx +0 -50
- package/src/components/Slider.tsx +0 -114
- package/src/components/StatsGrid.tsx +0 -35
- package/src/components/ViewModeToggle.tsx +0 -39
- package/src/components/modules/auth/Dashboard.tsx +0 -649
- package/src/components/modules/auth/MediaLightbox.tsx +0 -112
- package/src/components/modules/auth/PostCard.tsx +0 -556
- package/src/components/modules/auth/PostInteractionsModal.tsx +0 -138
- package/src/components/modules/auth/RepostModal.tsx +0 -167
- package/src/components/modules/auth/SidebarLeft.tsx +0 -237
- package/src/components/modules/auth/Stories.tsx +0 -69
- package/src/components/modules/auth/StoryViewer.tsx +0 -146
- package/src/components/modules/chat/ChatContainer.tsx +0 -332
- package/src/components/modules/chat/ChatInput.tsx +0 -57
- package/src/components/modules/chat/ChatList.tsx +0 -179
- package/src/components/modules/chat/ChatMessage.tsx +0 -43
- package/src/components/modules/chat/ChatNotes.tsx +0 -58
- package/src/components/modules/community/GroupHeader.tsx +0 -111
- package/src/components/modules/community/GroupMenu.tsx +0 -82
- package/src/components/modules/community/SchoolCard.tsx +0 -104
- package/src/components/modules/community/SurveyCard.tsx +0 -149
- package/src/components/modules/forum/ForumBoard.tsx +0 -78
- package/src/components/modules/forum/ForumPost.tsx +0 -71
- package/src/components/modules/forum/NewTopicModal.tsx +0 -112
- package/src/components/modules/forum/TopicItem.tsx +0 -72
- package/src/components/modules/galleries/GalleryCard.tsx +0 -66
- package/src/components/modules/giveaways/GiveawayCard.tsx +0 -76
- package/src/components/modules/groups/ApplicationModal.tsx +0 -133
- package/src/components/modules/groups/GroupCard.tsx +0 -96
- package/src/components/modules/guest/Introduction.tsx +0 -60
- package/src/components/modules/magaza/BackToStore.tsx +0 -53
- package/src/components/modules/magaza/StoreHeader.tsx +0 -74
- package/src/components/modules/news/NewsCard.tsx +0 -66
- package/src/components/modules/news/NewsComments.tsx +0 -141
- package/src/components/modules/profile/CloudStorageModal.tsx +0 -200
- package/src/components/modules/profile/EditProfileModal.tsx +0 -191
- package/src/components/modules/profile/ProfileContent.tsx +0 -491
- package/src/components/modules/profile/ProfileHeader.tsx +0 -128
- package/src/components/modules/profile/ProfileStats.tsx +0 -72
- package/src/components/modules/profile/TeamSelectorModal.tsx +0 -129
- package/src/components/modules/stations/StationCard.tsx +0 -95
- package/src/components/modules/stations/StationQRModal.tsx +0 -102
- package/src/components/shared/FloatingChatButton.tsx +0 -57
- package/src/components/shared/Footer.tsx +0 -77
- package/src/components/shared/Header.tsx +0 -799
- package/src/components/shared/LoginModal.tsx +0 -208
- package/src/components/shared/MainLayoutWrapper.tsx +0 -15
- package/src/components/shared/PageWidth.tsx +0 -22
- package/src/components/showcase/CommunityTab.tsx +0 -22
- package/src/components/showcase/CorporateTab.tsx +0 -38
- package/src/components/showcase/GeneralTab.tsx +0 -41
- package/src/components/showcase/MessagesTab.tsx +0 -26
- package/src/components/showcase/ProfileTab.tsx +0 -20
- package/src/components/showcase/ShopTab.tsx +0 -24
- package/src/components/showcase/SocialTab.tsx +0 -28
- package/src/context/AuthContext.tsx +0 -104
- package/src/context/CartContext.tsx +0 -93
- package/src/context/ChatContext.tsx +0 -32
- package/src/context/LayoutContext.tsx +0 -29
- package/src/context/SocketContext.tsx +0 -50
- package/src/context/ThemeContext.tsx +0 -52
- package/src/index.ts +0 -96
- package/src/lib/constants/educationData.ts +0 -124
- package/src/lib/constants/punishmentData.ts +0 -201
- package/src/lib/constants/seedData.ts +0 -758
- package/src/lib/constants/stationData.ts +0 -170
- package/src/lib/constants/surveyData.ts +0 -53
- package/src/lib/constants/teamData.ts +0 -69
- package/src/lib/utils/numberFormat.ts +0 -16
- package/src/lib/utils/odpUtils.ts +0 -51
- package/src/types/index.ts +0 -1
- package/src/types/stats.ts +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SocialTab.js","sourceRoot":"","sources":["../../../src/components/showcase/SocialTab.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SocialTab.js","sourceRoot":"","sources":["../../../src/components/showcase/SocialTab.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAa,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,eAAe,EACf,OAAO,EACP,QAAQ,EACR,QAAQ,EACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAA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AS,EAAC,yBAAyB,aACrC,KAAC,OAAO,KAAG,EACX,cAAK,SAAS,EAAC,uCAAuC,YAClD,YAAY,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,CAC/B,KAAC,QAAQ,OAEH,IAAI,EACR,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,IAF5B,IAAI,CAAC,EAAE,CAGZ,CACH,CAAC,GACC,EACL,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CACxC,cAAK,SAAS,EAAC,qEAAqE,YACjF,YAAG,SAAS,EAAC,gFAAgF,4EAAuC,GACjI,CACP,IACE,IACH,IACH,CACP,CAAC;AACJ,CAAC;AAED,gDAAgD;AAChD,SAAS,EAAE,CAAC,GAAG,OAAc;IAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { User, Session } from '@armoyu/core';
|
|
|
3
3
|
interface AuthContextType {
|
|
4
4
|
user: User | null;
|
|
5
5
|
session: Session | null;
|
|
6
|
-
login: (
|
|
6
|
+
login: (username: string, password: string) => Promise<void>;
|
|
7
7
|
logout: () => void;
|
|
8
8
|
isLoading: boolean;
|
|
9
9
|
isLoginModalOpen: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../src/context/AuthContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../src/context/AuthContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAU,MAAM,cAAc,CAAC;AAErD,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,UAAU,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;IACxC,aAAa,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAID,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CA+FvE;AAED,wBAAgB,OAAO,oBAMtB"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
-
import { Session } from '@armoyu/core';
|
|
5
|
-
import { userList, MOCK_SESSION } from '../lib/constants/seedData';
|
|
4
|
+
import { Session, armoyu } from '@armoyu/core';
|
|
6
5
|
const AuthContext = createContext(undefined);
|
|
7
6
|
export function AuthProvider({ children }) {
|
|
8
7
|
const [user, setUser] = useState(null);
|
|
@@ -10,49 +9,56 @@ export function AuthProvider({ children }) {
|
|
|
10
9
|
const [isLoading, setIsLoading] = useState(true);
|
|
11
10
|
const [isLoginModalOpen, setIsLoginModalOpen] = useState(false);
|
|
12
11
|
useEffect(() => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
async function restoreSession() {
|
|
13
|
+
// Check local storage for persistent token
|
|
14
|
+
const token = localStorage.getItem('armoyu_token');
|
|
15
|
+
if (token) {
|
|
16
|
+
try {
|
|
17
|
+
// Set token in core API client
|
|
18
|
+
armoyu.setToken(token);
|
|
19
|
+
// Request current user profile from real API
|
|
20
|
+
const me = await armoyu.auth.me();
|
|
21
|
+
if (me) {
|
|
22
|
+
setUser(me);
|
|
23
|
+
setSession(new Session({ user: me, token }));
|
|
24
|
+
console.log('[AuthContext] Session restored for:', me.username);
|
|
26
25
|
}
|
|
27
26
|
else {
|
|
28
|
-
|
|
27
|
+
// Token might be expired or invalid
|
|
28
|
+
localStorage.removeItem('armoyu_token');
|
|
29
|
+
armoyu.setToken(null);
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error('[AuthContext] Failed to restore session:', e);
|
|
34
|
+
localStorage.removeItem('armoyu_token');
|
|
35
|
+
armoyu.setToken(null);
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
console.error('Failed to restore session', e);
|
|
34
|
-
localStorage.removeItem('armoyu_user');
|
|
35
|
-
}
|
|
38
|
+
setIsLoading(false);
|
|
36
39
|
}
|
|
37
|
-
|
|
38
|
-
setIsLoading(false);
|
|
40
|
+
restoreSession();
|
|
39
41
|
}, []);
|
|
40
|
-
const login = (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const login = async (username, password) => {
|
|
43
|
+
try {
|
|
44
|
+
// Real API login via core library
|
|
45
|
+
const { user: loggedInUser, session: newSession } = await armoyu.auth.login(username, password);
|
|
46
|
+
setUser(loggedInUser);
|
|
47
|
+
setSession(newSession);
|
|
48
|
+
// Token is automatically stored in localStorage by armoyu.auth.login()
|
|
49
|
+
// but we ensure it matches our expectations
|
|
50
|
+
console.log('[AuthContext] Login successful for:', loggedInUser.username);
|
|
51
|
+
setIsLoginModalOpen(false);
|
|
45
52
|
}
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('[AuthContext] Login failed:', error);
|
|
55
|
+
throw error; // Let the component handle the error UI
|
|
48
56
|
}
|
|
49
|
-
localStorage.setItem('armoyu_user', JSON.stringify({ username: userData.username }));
|
|
50
|
-
setIsLoginModalOpen(false); // Close modal on success
|
|
51
57
|
};
|
|
52
58
|
const logout = () => {
|
|
59
|
+
armoyu.auth.logout(); // Clears internal state and localStorage
|
|
53
60
|
setUser(null);
|
|
54
61
|
setSession(null);
|
|
55
|
-
localStorage.removeItem('armoyu_user');
|
|
56
62
|
};
|
|
57
63
|
const updateUser = (updatedUser) => {
|
|
58
64
|
setUser(updatedUser);
|
|
@@ -62,8 +68,21 @@ export function AuthProvider({ children }) {
|
|
|
62
68
|
};
|
|
63
69
|
const updateSession = (updatedSession) => {
|
|
64
70
|
setSession(updatedSession);
|
|
71
|
+
if (updatedSession.token) {
|
|
72
|
+
armoyu.setToken(updatedSession.token);
|
|
73
|
+
}
|
|
65
74
|
};
|
|
66
|
-
return (_jsx(AuthContext.Provider, { value: {
|
|
75
|
+
return (_jsx(AuthContext.Provider, { value: {
|
|
76
|
+
user,
|
|
77
|
+
session,
|
|
78
|
+
login,
|
|
79
|
+
logout,
|
|
80
|
+
isLoading,
|
|
81
|
+
isLoginModalOpen,
|
|
82
|
+
setIsLoginModalOpen,
|
|
83
|
+
updateUser,
|
|
84
|
+
updateSession
|
|
85
|
+
}, children: children }));
|
|
67
86
|
}
|
|
68
87
|
export function useAuth() {
|
|
69
88
|
const context = useContext(AuthContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthContext.js","sourceRoot":"","sources":["../../src/context/AuthContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO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,GAAG,GAAG,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,yCAAyC;QAC/D,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,WAAiB,EAAE,EAAE;QACvC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrB,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CAAC,IAAI,OAAO,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,cAAuB,EAAE,EAAE;QAChD,UAAU,CAAC,cAAc,CAAC,CAAC;QAC3B,IAAI,cAAc,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE;YAC3B,IAAI;YACJ,OAAO;YACP,KAAK;YACL,MAAM;YACN,SAAS;YACT,gBAAgB;YAChB,mBAAmB;YACnB,UAAU;YACV,aAAa;SACd,YACE,QAAQ,GACY,CACxB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
-
import { CartItem } from '@armoyu/core';
|
|
5
|
-
const CartContext = createContext(undefined);
|
|
6
|
-
export function CartProvider({ children }) {
|
|
7
|
-
const [cart, setCart] = useState([]);
|
|
8
|
-
// Load cart from localStorage on mount
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const savedCart = localStorage.getItem('armoyu_cart');
|
|
11
|
-
if (savedCart) {
|
|
12
|
-
try {
|
|
13
|
-
const parsed = JSON.parse(savedCart);
|
|
14
|
-
setCart(parsed.map((i) => CartItem.fromJSON(i)));
|
|
15
|
-
}
|
|
16
|
-
catch (e) {
|
|
17
|
-
console.error('Failed to parse cart', e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}, []);
|
|
21
|
-
// Save cart to localStorage on change
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
localStorage.setItem('armoyu_cart', JSON.stringify(cart));
|
|
24
|
-
}, [cart]);
|
|
25
|
-
const addToCart = (product, quantity = 1) => {
|
|
26
|
-
setCart(prev => {
|
|
27
|
-
const existing = prev.find(item => item.product.id === product.id);
|
|
28
|
-
if (existing) {
|
|
29
|
-
return prev.map(item => item.product.id === product.id
|
|
30
|
-
? new CartItem({ ...item, quantity: item.quantity + quantity })
|
|
31
|
-
: item);
|
|
32
|
-
}
|
|
33
|
-
return [...prev, new CartItem({ product, quantity })];
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const removeFromCart = (productId) => {
|
|
37
|
-
setCart(prev => prev.filter(item => item.product.id !== productId));
|
|
38
|
-
};
|
|
39
|
-
const updateQuantity = (productId, quantity) => {
|
|
40
|
-
setCart(prev => prev.map(item => item.product.id === productId
|
|
41
|
-
? new CartItem({ ...item, quantity: Math.max(1, quantity) })
|
|
42
|
-
: item));
|
|
43
|
-
};
|
|
44
|
-
const clearCart = () => setCart([]);
|
|
45
|
-
const totalItems = cart.reduce((acc, item) => acc + item.quantity, 0);
|
|
46
|
-
const totalPrice = cart.reduce((acc, item) => acc + item.getTotalPrice(), 0);
|
|
47
|
-
return (_jsx(CartContext.Provider, { value: {
|
|
48
|
-
cart,
|
|
49
|
-
addToCart,
|
|
50
|
-
removeFromCart,
|
|
51
|
-
updateQuantity,
|
|
52
|
-
clearCart,
|
|
53
|
-
totalItems,
|
|
54
|
-
totalPrice
|
|
55
|
-
}, children: children }));
|
|
56
|
-
}
|
|
57
|
-
export function useCart() {
|
|
58
|
-
const context = useContext(CartContext);
|
|
59
|
-
if (context === undefined) {
|
|
60
|
-
throw new Error('useCart must be used within a CartProvider');
|
|
61
|
-
}
|
|
62
|
-
return context;
|
|
63
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
+
import { CartItem } from '@armoyu/core';
|
|
5
|
+
const CartContext = createContext(undefined);
|
|
6
|
+
export function CartProvider({ children }) {
|
|
7
|
+
const [cart, setCart] = useState([]);
|
|
8
|
+
// Load cart from localStorage on mount
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const savedCart = localStorage.getItem('armoyu_cart');
|
|
11
|
+
if (savedCart) {
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(savedCart);
|
|
14
|
+
setCart(parsed.map((i) => CartItem.fromJSON(i)));
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
console.error('Failed to parse cart', e);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
// Save cart to localStorage on change
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
localStorage.setItem('armoyu_cart', JSON.stringify(cart));
|
|
24
|
+
}, [cart]);
|
|
25
|
+
const addToCart = (product, quantity = 1) => {
|
|
26
|
+
setCart(prev => {
|
|
27
|
+
const existing = prev.find(item => item.product.id === product.id);
|
|
28
|
+
if (existing) {
|
|
29
|
+
return prev.map(item => item.product.id === product.id
|
|
30
|
+
? new CartItem({ ...item, quantity: item.quantity + quantity })
|
|
31
|
+
: item);
|
|
32
|
+
}
|
|
33
|
+
return [...prev, new CartItem({ product, quantity })];
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
const removeFromCart = (productId) => {
|
|
37
|
+
setCart(prev => prev.filter(item => item.product.id !== productId));
|
|
38
|
+
};
|
|
39
|
+
const updateQuantity = (productId, quantity) => {
|
|
40
|
+
setCart(prev => prev.map(item => item.product.id === productId
|
|
41
|
+
? new CartItem({ ...item, quantity: Math.max(1, quantity) })
|
|
42
|
+
: item));
|
|
43
|
+
};
|
|
44
|
+
const clearCart = () => setCart([]);
|
|
45
|
+
const totalItems = cart.reduce((acc, item) => acc + item.quantity, 0);
|
|
46
|
+
const totalPrice = cart.reduce((acc, item) => acc + item.getTotalPrice(), 0);
|
|
47
|
+
return (_jsx(CartContext.Provider, { value: {
|
|
48
|
+
cart,
|
|
49
|
+
addToCart,
|
|
50
|
+
removeFromCart,
|
|
51
|
+
updateQuantity,
|
|
52
|
+
clearCart,
|
|
53
|
+
totalItems,
|
|
54
|
+
totalPrice
|
|
55
|
+
}, children: children }));
|
|
56
|
+
}
|
|
57
|
+
export function useCart() {
|
|
58
|
+
const context = useContext(CartContext);
|
|
59
|
+
if (context === undefined) {
|
|
60
|
+
throw new Error('useCart must be used within a CartProvider');
|
|
61
|
+
}
|
|
62
|
+
return context;
|
|
63
|
+
}
|
|
64
64
|
//# sourceMappingURL=CartContext.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface ChatContextType {
|
|
3
|
-
isChatOpen: boolean;
|
|
4
|
-
toggleChat: () => void;
|
|
5
|
-
openChat: () => void;
|
|
6
|
-
closeChat: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function ChatProvider({ children }: {
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function useChat(): ChatContextType;
|
|
12
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ChatContextType {
|
|
3
|
+
isChatOpen: boolean;
|
|
4
|
+
toggleChat: () => void;
|
|
5
|
+
openChat: () => void;
|
|
6
|
+
closeChat: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ChatProvider({ children }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function useChat(): ChatContextType;
|
|
12
|
+
export {};
|
|
13
13
|
//# sourceMappingURL=ChatContext.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState } from 'react';
|
|
4
|
-
const ChatContext = createContext(undefined);
|
|
5
|
-
export function ChatProvider({ children }) {
|
|
6
|
-
const [isChatOpen, setIsChatOpen] = useState(false);
|
|
7
|
-
const toggleChat = () => setIsChatOpen(!isChatOpen);
|
|
8
|
-
const openChat = () => setIsChatOpen(true);
|
|
9
|
-
const closeChat = () => setIsChatOpen(false);
|
|
10
|
-
return (_jsx(ChatContext.Provider, { value: { isChatOpen, toggleChat, openChat, closeChat }, children: children }));
|
|
11
|
-
}
|
|
12
|
-
export function useChat() {
|
|
13
|
-
const context = useContext(ChatContext);
|
|
14
|
-
if (!context)
|
|
15
|
-
throw new Error('useChat must be used within ChatProvider');
|
|
16
|
-
return context;
|
|
17
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState } from 'react';
|
|
4
|
+
const ChatContext = createContext(undefined);
|
|
5
|
+
export function ChatProvider({ children }) {
|
|
6
|
+
const [isChatOpen, setIsChatOpen] = useState(false);
|
|
7
|
+
const toggleChat = () => setIsChatOpen(!isChatOpen);
|
|
8
|
+
const openChat = () => setIsChatOpen(true);
|
|
9
|
+
const closeChat = () => setIsChatOpen(false);
|
|
10
|
+
return (_jsx(ChatContext.Provider, { value: { isChatOpen, toggleChat, openChat, closeChat }, children: children }));
|
|
11
|
+
}
|
|
12
|
+
export function useChat() {
|
|
13
|
+
const context = useContext(ChatContext);
|
|
14
|
+
if (!context)
|
|
15
|
+
throw new Error('useChat must be used within ChatProvider');
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=ChatContext.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
type LayoutContextType = {
|
|
3
|
-
pageWidth: string;
|
|
4
|
-
setPageWidth: (width: string) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare function LayoutProvider({ children }: {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function useLayout(): LayoutContextType;
|
|
10
|
-
export {};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type LayoutContextType = {
|
|
3
|
+
pageWidth: string;
|
|
4
|
+
setPageWidth: (width: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function LayoutProvider({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useLayout(): LayoutContextType;
|
|
10
|
+
export {};
|
|
11
11
|
//# sourceMappingURL=LayoutContext.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState } from 'react';
|
|
4
|
-
const LayoutContext = createContext(undefined);
|
|
5
|
-
export function LayoutProvider({ children }) {
|
|
6
|
-
// Varsayılan masaüstü değeri %80 olarak ayarlanmıştır.
|
|
7
|
-
const [pageWidth, setPageWidth] = useState('max-w-[80%]');
|
|
8
|
-
return (_jsx(LayoutContext.Provider, { value: { pageWidth, setPageWidth }, children: children }));
|
|
9
|
-
}
|
|
10
|
-
export function useLayout() {
|
|
11
|
-
const context = useContext(LayoutContext);
|
|
12
|
-
if (!context) {
|
|
13
|
-
throw new Error('useLayout must be used within a LayoutProvider');
|
|
14
|
-
}
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState } from 'react';
|
|
4
|
+
const LayoutContext = createContext(undefined);
|
|
5
|
+
export function LayoutProvider({ children }) {
|
|
6
|
+
// Varsayılan masaüstü değeri %80 olarak ayarlanmıştır.
|
|
7
|
+
const [pageWidth, setPageWidth] = useState('max-w-[80%]');
|
|
8
|
+
return (_jsx(LayoutContext.Provider, { value: { pageWidth, setPageWidth }, children: children }));
|
|
9
|
+
}
|
|
10
|
+
export function useLayout() {
|
|
11
|
+
const context = useContext(LayoutContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('useLayout must be used within a LayoutProvider');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=LayoutContext.js.map
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
-
import { socketService } from '@armoyu/core';
|
|
5
|
-
const SocketContext = createContext(undefined);
|
|
6
|
-
export function SocketProvider({ children }) {
|
|
7
|
-
const [isConnected, setIsConnected] = useState(socketService.isConnected);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const handleConnect = () => setIsConnected(true);
|
|
10
|
-
const handleDisconnect = () => setIsConnected(false);
|
|
11
|
-
const offConnect = socketService.on('connect', handleConnect);
|
|
12
|
-
const offDisconnect = socketService.on('disconnect', handleDisconnect);
|
|
13
|
-
return () => {
|
|
14
|
-
offConnect();
|
|
15
|
-
offDisconnect();
|
|
16
|
-
};
|
|
17
|
-
}, []);
|
|
18
|
-
return (_jsx(SocketContext.Provider, { value: {
|
|
19
|
-
isConnected,
|
|
20
|
-
emit: socketService.emit.bind(socketService),
|
|
21
|
-
on: socketService.on.bind(socketService)
|
|
22
|
-
}, children: children }));
|
|
23
|
-
}
|
|
24
|
-
export function useSocket() {
|
|
25
|
-
const context = useContext(SocketContext);
|
|
26
|
-
if (context === undefined) {
|
|
27
|
-
throw new Error('useSocket must be used within a SocketProvider');
|
|
28
|
-
}
|
|
29
|
-
return context;
|
|
30
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
+
import { socketService } from '@armoyu/core';
|
|
5
|
+
const SocketContext = createContext(undefined);
|
|
6
|
+
export function SocketProvider({ children }) {
|
|
7
|
+
const [isConnected, setIsConnected] = useState(socketService.isConnected);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const handleConnect = () => setIsConnected(true);
|
|
10
|
+
const handleDisconnect = () => setIsConnected(false);
|
|
11
|
+
const offConnect = socketService.on('connect', handleConnect);
|
|
12
|
+
const offDisconnect = socketService.on('disconnect', handleDisconnect);
|
|
13
|
+
return () => {
|
|
14
|
+
offConnect();
|
|
15
|
+
offDisconnect();
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
return (_jsx(SocketContext.Provider, { value: {
|
|
19
|
+
isConnected,
|
|
20
|
+
emit: socketService.emit.bind(socketService),
|
|
21
|
+
on: socketService.on.bind(socketService)
|
|
22
|
+
}, children: children }));
|
|
23
|
+
}
|
|
24
|
+
export function useSocket() {
|
|
25
|
+
const context = useContext(SocketContext);
|
|
26
|
+
if (context === undefined) {
|
|
27
|
+
throw new Error('useSocket must be used within a SocketProvider');
|
|
28
|
+
}
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
31
|
//# sourceMappingURL=SocketContext.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface ThemeContextType {
|
|
3
|
-
theme: 'dark' | 'light';
|
|
4
|
-
toggleTheme: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare function ThemeProvider({ children }: {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function useTheme(): ThemeContextType;
|
|
10
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ThemeContextType {
|
|
3
|
+
theme: 'dark' | 'light';
|
|
4
|
+
toggleTheme: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function ThemeProvider({ children }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useTheme(): ThemeContextType;
|
|
10
|
+
export {};
|
|
11
11
|
//# sourceMappingURL=ThemeContext.d.ts.map
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
-
const ThemeContext = createContext(undefined);
|
|
5
|
-
export function ThemeProvider({ children }) {
|
|
6
|
-
const [theme, setTheme] = useState('dark');
|
|
7
|
-
// Tarayıcı hafızasını okuyarak temayı yükleme (Local Storage)
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const savedTheme = localStorage.getItem('armoyu_theme');
|
|
10
|
-
if (savedTheme === 'light') {
|
|
11
|
-
setTheme('light');
|
|
12
|
-
document.documentElement.classList.remove('dark');
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
setTheme('dark');
|
|
16
|
-
document.documentElement.classList.add('dark');
|
|
17
|
-
// İlk girişte varsayılan olarak depolanır
|
|
18
|
-
localStorage.setItem('armoyu_theme', 'dark');
|
|
19
|
-
}
|
|
20
|
-
}, []);
|
|
21
|
-
const toggleTheme = () => {
|
|
22
|
-
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
23
|
-
setTheme(newTheme);
|
|
24
|
-
localStorage.setItem('armoyu_theme', newTheme);
|
|
25
|
-
if (newTheme === 'dark') {
|
|
26
|
-
document.documentElement.classList.add('dark');
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
document.documentElement.classList.remove('dark');
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
return (_jsx(ThemeContext.Provider, { value: { theme, toggleTheme }, children: children }));
|
|
33
|
-
}
|
|
34
|
-
export function useTheme() {
|
|
35
|
-
const context = useContext(ThemeContext);
|
|
36
|
-
if (!context)
|
|
37
|
-
throw new Error('useTheme hooks must be used inside ThemeProvider!');
|
|
38
|
-
return context;
|
|
39
|
-
}
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useState, useEffect } from 'react';
|
|
4
|
+
const ThemeContext = createContext(undefined);
|
|
5
|
+
export function ThemeProvider({ children }) {
|
|
6
|
+
const [theme, setTheme] = useState('dark');
|
|
7
|
+
// Tarayıcı hafızasını okuyarak temayı yükleme (Local Storage)
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const savedTheme = localStorage.getItem('armoyu_theme');
|
|
10
|
+
if (savedTheme === 'light') {
|
|
11
|
+
setTheme('light');
|
|
12
|
+
document.documentElement.classList.remove('dark');
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
setTheme('dark');
|
|
16
|
+
document.documentElement.classList.add('dark');
|
|
17
|
+
// İlk girişte varsayılan olarak depolanır
|
|
18
|
+
localStorage.setItem('armoyu_theme', 'dark');
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
const toggleTheme = () => {
|
|
22
|
+
const newTheme = theme === 'dark' ? 'light' : 'dark';
|
|
23
|
+
setTheme(newTheme);
|
|
24
|
+
localStorage.setItem('armoyu_theme', newTheme);
|
|
25
|
+
if (newTheme === 'dark') {
|
|
26
|
+
document.documentElement.classList.add('dark');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
document.documentElement.classList.remove('dark');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return (_jsx(ThemeContext.Provider, { value: { theme, toggleTheme }, children: children }));
|
|
33
|
+
}
|
|
34
|
+
export function useTheme() {
|
|
35
|
+
const context = useContext(ThemeContext);
|
|
36
|
+
if (!context)
|
|
37
|
+
throw new Error('useTheme hooks must be used inside ThemeProvider!');
|
|
38
|
+
return context;
|
|
39
|
+
}
|
|
40
40
|
//# sourceMappingURL=ThemeContext.js.map
|