hackmate-cli 1.0.28 → 1.1.0
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/Dashboard.d.ts +2 -0
- package/dist/Dashboard.d.ts.map +1 -0
- package/dist/Dashboard.js +69 -0
- package/dist/Dashboard.js.map +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +9 -1
- package/dist/api.js.map +1 -1
- package/dist/cli.js +5 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/Config.d.ts.map +1 -1
- package/dist/commands/Config.js +6 -5
- package/dist/commands/Config.js.map +1 -1
- package/dist/commands/DataExport.d.ts.map +1 -1
- package/dist/commands/DataExport.js +11 -15
- package/dist/commands/DataExport.js.map +1 -1
- package/dist/commands/Discover.d.ts.map +1 -1
- package/dist/commands/Discover.js +28 -74
- package/dist/commands/Discover.js.map +1 -1
- package/dist/commands/MatchList.d.ts.map +1 -1
- package/dist/commands/MatchList.js +49 -76
- package/dist/commands/MatchList.js.map +1 -1
- package/dist/commands/Presence.d.ts.map +1 -1
- package/dist/commands/Presence.js +10 -8
- package/dist/commands/Presence.js.map +1 -1
- package/dist/commands/Privacy.d.ts.map +1 -1
- package/dist/commands/Privacy.js +16 -31
- package/dist/commands/Privacy.js.map +1 -1
- package/dist/commands/Settings.d.ts.map +1 -1
- package/dist/commands/Settings.js +13 -31
- package/dist/commands/Settings.js.map +1 -1
- package/dist/commands/Stats.d.ts.map +1 -1
- package/dist/commands/Stats.js +12 -31
- package/dist/commands/Stats.js.map +1 -1
- package/dist/features/chat/components/ChatList.d.ts.map +1 -1
- package/dist/features/chat/components/ChatList.js +20 -38
- package/dist/features/chat/components/ChatList.js.map +1 -1
- package/dist/features/network/components/UnfriendByUsername.d.ts.map +1 -1
- package/dist/features/network/components/UnfriendByUsername.js +8 -8
- package/dist/features/network/components/UnfriendByUsername.js.map +1 -1
- package/dist/features/network/components/network.screen.d.ts.map +1 -1
- package/dist/features/network/components/network.screen.js +8 -7
- package/dist/features/network/components/network.screen.js.map +1 -1
- package/dist/features/profile/components/profile-edit-v3.screen.d.ts.map +1 -1
- package/dist/features/profile/components/profile-edit-v3.screen.js +14 -0
- package/dist/features/profile/components/profile-edit-v3.screen.js.map +1 -1
- package/dist/features/profile/components/profile-edit.screen.d.ts.map +1 -1
- package/dist/features/profile/components/profile-edit.screen.js +12 -12
- package/dist/features/profile/components/profile-edit.screen.js.map +1 -1
- package/dist/features/profile/components/profile-view.screen.d.ts.map +1 -1
- package/dist/features/profile/components/profile-view.screen.js +14 -17
- package/dist/features/profile/components/profile-view.screen.js.map +1 -1
- package/dist/shared/components/DataList.d.ts +10 -0
- package/dist/shared/components/DataList.d.ts.map +1 -0
- package/dist/shared/components/DataList.js +9 -0
- package/dist/shared/components/DataList.js.map +1 -0
- package/dist/shared/components/ErrorState.d.ts +7 -0
- package/dist/shared/components/ErrorState.d.ts.map +1 -0
- package/dist/shared/components/ErrorState.js +6 -0
- package/dist/shared/components/ErrorState.js.map +1 -0
- package/dist/shared/components/Loader.d.ts +7 -0
- package/dist/shared/components/Loader.d.ts.map +1 -0
- package/dist/shared/components/Loader.js +7 -0
- package/dist/shared/components/Loader.js.map +1 -0
- package/dist/shared/components/Screen.d.ts +10 -0
- package/dist/shared/components/Screen.d.ts.map +1 -0
- package/dist/shared/components/Screen.js +6 -0
- package/dist/shared/components/Screen.js.map +1 -0
- package/dist/shared/components/index.d.ts +5 -0
- package/dist/shared/components/index.d.ts.map +1 -0
- package/dist/shared/components/index.js +5 -0
- package/dist/shared/components/index.js.map +1 -0
- package/dist/shared/hooks/useAsyncRequest.d.ts +9 -0
- package/dist/shared/hooks/useAsyncRequest.d.ts.map +1 -0
- package/dist/shared/hooks/useAsyncRequest.js +52 -0
- package/dist/shared/hooks/useAsyncRequest.js.map +1 -0
- package/dist/shared/hooks/useListNavigation.d.ts +5 -0
- package/dist/shared/hooks/useListNavigation.d.ts.map +1 -0
- package/dist/shared/hooks/useListNavigation.js +15 -0
- package/dist/shared/hooks/useListNavigation.js.map +1 -0
- package/package.json +4 -4
|
@@ -1,70 +1,21 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { useState
|
|
3
|
-
import { Box, Text, useInput
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
4
|
import SelectInput from 'ink-select-input';
|
|
5
5
|
import api from '../api.js';
|
|
6
|
-
import { useAuth } from '../context/index.js';
|
|
7
6
|
import { Chat } from '../features/chat/index.js';
|
|
8
7
|
import { ProfileView } from '../features/profile/index.js';
|
|
8
|
+
import { useAsyncRequest } from '../shared/hooks/useAsyncRequest.js';
|
|
9
|
+
import { useListNavigation } from '../shared/hooks/useListNavigation.js';
|
|
10
|
+
import { useEscapeKey } from '../shared/hooks/useEscapeKey.js';
|
|
11
|
+
import { Screen, Loader, ErrorState, DataList } from '../shared/components/index.js';
|
|
9
12
|
export const MatchList = () => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const [loading, setLoading] = useState(true);
|
|
14
|
-
const [error, setError] = useState(null);
|
|
15
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
13
|
+
const { data: matches, loading, error } = useAsyncRequest('/match/top?limit=10');
|
|
14
|
+
// We only initialize navigation if we have matches, defaulting to 0
|
|
15
|
+
const { selectedIndex, setSelectedIndex } = useListNavigation(matches?.length || 0);
|
|
16
16
|
const [viewMode, setViewMode] = useState('list');
|
|
17
17
|
const [actionMessage, setActionMessage] = useState(null);
|
|
18
|
-
|
|
19
|
-
if (viewMode === 'list') {
|
|
20
|
-
if (key.escape) {
|
|
21
|
-
exit();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (key.upArrow) {
|
|
25
|
-
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
26
|
-
}
|
|
27
|
-
if (key.downArrow) {
|
|
28
|
-
setSelectedIndex(Math.min(matches.length - 1, selectedIndex + 1));
|
|
29
|
-
}
|
|
30
|
-
if (key.return) {
|
|
31
|
-
setViewMode('actions');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else if (viewMode === 'profile') {
|
|
35
|
-
if (key.escape) {
|
|
36
|
-
setViewMode('list');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (authLoading)
|
|
42
|
-
return;
|
|
43
|
-
if (!isAuthenticated) {
|
|
44
|
-
setError('Please login first using "hackmate auth login"');
|
|
45
|
-
setLoading(false);
|
|
46
|
-
setTimeout(() => exit(), 100);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const fetchMatches = async () => {
|
|
50
|
-
try {
|
|
51
|
-
const { data } = await api.get('/match/top?limit=10');
|
|
52
|
-
setMatches(data);
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
let msg = err.response?.data?.message || 'Failed to fetch matches';
|
|
56
|
-
if (msg.includes('No Authorization')) {
|
|
57
|
-
msg = 'Please login first using "hackmate auth login"';
|
|
58
|
-
}
|
|
59
|
-
setError(msg);
|
|
60
|
-
setTimeout(() => exit(), 100);
|
|
61
|
-
}
|
|
62
|
-
finally {
|
|
63
|
-
setLoading(false);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
fetchMatches();
|
|
67
|
-
}, [isAuthenticated, authLoading]);
|
|
18
|
+
// Actions
|
|
68
19
|
const handleActionSelect = async (item) => {
|
|
69
20
|
if (item.value === 'back') {
|
|
70
21
|
setViewMode('list');
|
|
@@ -74,45 +25,67 @@ export const MatchList = () => {
|
|
|
74
25
|
}
|
|
75
26
|
else if (item.value === 'dm') {
|
|
76
27
|
setViewMode('chat');
|
|
77
|
-
// Chat component handles input, so we don't need to do anything else here
|
|
78
28
|
}
|
|
79
29
|
else if (item.value === 'follow') {
|
|
80
30
|
try {
|
|
81
31
|
const targetId = matches[selectedIndex].userId._id;
|
|
82
32
|
await api.post('/network/request', { targetUserId: targetId });
|
|
83
|
-
setActionMessage(`✅
|
|
33
|
+
setActionMessage(`✅ Request sent!`);
|
|
84
34
|
}
|
|
85
35
|
catch (e) {
|
|
86
36
|
setActionMessage(`❌ Error: ${e.response?.data?.message || e.message}`);
|
|
87
37
|
}
|
|
88
|
-
// Clear message after 3s
|
|
89
38
|
setTimeout(() => setActionMessage(null), 3000);
|
|
90
39
|
setViewMode('list');
|
|
91
40
|
}
|
|
92
41
|
};
|
|
42
|
+
// Sub-view component for Chat
|
|
43
|
+
if (viewMode === 'chat' && matches) {
|
|
44
|
+
return _jsx(Chat, { targetUsername: matches[selectedIndex].userId.username, onExit: () => setViewMode('list') });
|
|
45
|
+
}
|
|
46
|
+
// Manual input handling for switching views (since useListNavigation only handles index)
|
|
47
|
+
useInput((input, key) => {
|
|
48
|
+
if (viewMode === 'list') {
|
|
49
|
+
if (key.return && matches && matches.length > 0)
|
|
50
|
+
setViewMode('actions');
|
|
51
|
+
// Standard exit handling is tricky if we want to "Back" from actions.
|
|
52
|
+
// We can handle Esc here for 'actions' view as well?
|
|
53
|
+
// Ideally we'd use a unified key handler.
|
|
54
|
+
}
|
|
55
|
+
else if (viewMode === 'profile' && key.escape) {
|
|
56
|
+
setViewMode('list');
|
|
57
|
+
}
|
|
58
|
+
else if (viewMode === 'actions' && key.escape) {
|
|
59
|
+
setViewMode('list');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
// Top level escape handler
|
|
63
|
+
useEscapeKey(() => {
|
|
64
|
+
if (viewMode !== 'list') {
|
|
65
|
+
setViewMode('list');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Exit app
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
93
72
|
if (loading)
|
|
94
|
-
return _jsx(
|
|
73
|
+
return _jsx(Loader, { text: "Finding your best matches..." });
|
|
95
74
|
if (error)
|
|
96
|
-
return
|
|
75
|
+
return _jsx(ErrorState, { error: error });
|
|
97
76
|
// Empty state
|
|
98
|
-
if (matches.length === 0) {
|
|
99
|
-
return (_jsxs(
|
|
77
|
+
if (!matches || matches.length === 0) {
|
|
78
|
+
return (_jsxs(Screen, { title: "Match Queue", borderColor: "magenta", children: [_jsx(Text, { children: "No new matches found." }), _jsx(Text, { color: "gray", children: "Try updating your profile or filters!" })] }));
|
|
100
79
|
}
|
|
101
80
|
const selectedMatch = matches[selectedIndex];
|
|
102
|
-
// CHAT VIEW
|
|
103
|
-
if (viewMode === 'chat') {
|
|
104
|
-
return _jsx(Chat, { targetUsername: selectedMatch.userId.username, onExit: () => setViewMode('list') });
|
|
105
|
-
}
|
|
106
|
-
// PROFILE VIEW
|
|
107
81
|
if (viewMode === 'profile') {
|
|
108
|
-
return (
|
|
82
|
+
return (_jsx(Screen, { title: `Profile: @${selectedMatch.userId.username}`, borderColor: "cyan", children: _jsx(ProfileView, { username: selectedMatch.userId.username }) }));
|
|
109
83
|
}
|
|
110
|
-
|
|
111
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", padding: 1, children: [_jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [_jsx(Text, { bold: true, underline: true, color: "magenta", children: "\uD83D\uDC95 Your Top Matches" }), actionMessage && _jsx(Text, { bold: true, color: actionMessage.includes('Error') ? 'red' : 'green', children: actionMessage })] }), viewMode === 'actions' ? (_jsxs(Box, { flexDirection: "column", marginY: 1, borderStyle: "round", borderColor: "yellow", padding: 1, children: [_jsxs(Text, { bold: true, color: "yellow", children: ["Selected: @", selectedMatch.userId.username] }), _jsx(Text, { color: "gray", children: "Choose an action:" }), _jsx(SelectInput, { items: [
|
|
84
|
+
return (_jsxs(Screen, { title: "Your Top Matches", borderColor: "magenta", children: [actionMessage && _jsx(Text, { bold: true, color: actionMessage.includes('Error') ? 'red' : 'green', children: actionMessage }), viewMode === 'actions' ? (_jsxs(Box, { flexDirection: "column", marginY: 1, borderStyle: "round", borderColor: "yellow", padding: 1, children: [_jsxs(Text, { bold: true, color: "yellow", children: ["Selected: @", selectedMatch.userId.username] }), _jsx(SelectInput, { items: [
|
|
112
85
|
{ label: '📄 View Full Profile', value: 'view' },
|
|
113
86
|
{ label: '💬 Send Message (DM)', value: 'dm' },
|
|
114
87
|
{ label: '👋 Follow / Connect', value: 'follow' },
|
|
115
88
|
{ label: '⬅️ Back to List', value: 'back' }
|
|
116
|
-
], onSelect: handleActionSelect })] })) : (
|
|
89
|
+
], onSelect: handleActionSelect })] })) : (_jsx(DataList, { items: matches, selectedIndex: selectedIndex, renderItem: (match, isSelected) => (_jsxs(Box, { borderStyle: isSelected ? 'bold' : 'single', borderColor: isSelected ? 'cyan' : 'gray', flexDirection: "column", paddingX: 1, marginBottom: 1, children: [_jsxs(Box, { justifyContent: "space-between", children: [_jsxs(Text, { bold: true, color: isSelected ? "green" : "white", children: ["@", match.userId.username] }), _jsxs(Text, { color: "yellow", children: [" ", match.compatibilityPercentage, "%"] })] }), _jsx(Text, { children: match.fullName }), _jsxs(Text, { color: "cyan", children: ["\uD83D\uDCBB ", match.stack.slice(0, 3).join(', ')] })] })) }))] }));
|
|
117
90
|
};
|
|
118
91
|
//# sourceMappingURL=MatchList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchList.js","sourceRoot":"","sources":["../../src/commands/MatchList.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"MatchList.js","sourceRoot":"","sources":["../../src/commands/MatchList.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B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CAAC,CAAC,CAAC,OAAO,kBAC1C,KAAK,CAAC,MAAM,CAAC,QAAQ,IACpB,EACP,MAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,kBAAG,KAAK,CAAC,uBAAuB,SAAS,IAC3D,EACN,KAAC,IAAI,cAAE,KAAK,CAAC,QAAQ,GAAQ,EAC7B,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,8BAAK,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAQ,IAC/D,CACT,GACH,CACL,IACI,CACZ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presence.d.ts","sourceRoot":"","sources":["../../src/commands/Presence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Presence.d.ts","sourceRoot":"","sources":["../../src/commands/Presence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAOxC,UAAU,aAAa;IACnB,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAClD;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoD5C,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Text } from 'ink';
|
|
4
4
|
import api from '../api.js';
|
|
5
5
|
import { useAuth } from '../context/index.js';
|
|
6
|
+
import { useApp } from 'ink';
|
|
7
|
+
import { Screen, Loader, ErrorState } from '../shared/components/index.js';
|
|
6
8
|
export const Presence = ({ status }) => {
|
|
7
9
|
const { exit } = useApp();
|
|
8
10
|
const { isAuthenticated, isLoading: authLoading } = useAuth();
|
|
@@ -15,7 +17,8 @@ export const Presence = ({ status }) => {
|
|
|
15
17
|
if (!isAuthenticated) {
|
|
16
18
|
setError('Please login first using "hackmate auth login"');
|
|
17
19
|
setLoading(false);
|
|
18
|
-
|
|
20
|
+
// Don't auto-exit immediately on error if we want user to see it
|
|
21
|
+
// usually we let them see it then exit.
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
24
|
const updatePresence = async () => {
|
|
@@ -23,7 +26,7 @@ export const Presence = ({ status }) => {
|
|
|
23
26
|
try {
|
|
24
27
|
await api.put('/presence/status', { status });
|
|
25
28
|
setSuccess(true);
|
|
26
|
-
setTimeout(() => exit(), 1500);
|
|
29
|
+
setTimeout(() => exit(), 1500);
|
|
27
30
|
}
|
|
28
31
|
catch (err) {
|
|
29
32
|
let msg = err.response?.data?.message || 'Failed to update presence';
|
|
@@ -31,7 +34,6 @@ export const Presence = ({ status }) => {
|
|
|
31
34
|
msg = 'Please login first using "hackmate auth login"';
|
|
32
35
|
}
|
|
33
36
|
setError(msg);
|
|
34
|
-
setTimeout(() => exit(), 100);
|
|
35
37
|
}
|
|
36
38
|
finally {
|
|
37
39
|
setLoading(false);
|
|
@@ -40,13 +42,13 @@ export const Presence = ({ status }) => {
|
|
|
40
42
|
updatePresence();
|
|
41
43
|
}, [status, isAuthenticated, authLoading]);
|
|
42
44
|
if (loading || authLoading)
|
|
43
|
-
return _jsx(
|
|
45
|
+
return _jsx(Loader, { text: "Updating presence..." });
|
|
44
46
|
if (error)
|
|
45
|
-
return
|
|
47
|
+
return _jsx(ErrorState, { error: error });
|
|
46
48
|
if (success) {
|
|
47
49
|
const color = status === 'online' ? 'green' : status === 'away' ? 'yellow' : status === 'busy' ? 'red' : 'gray';
|
|
48
|
-
return (_jsx(
|
|
50
|
+
return (_jsx(Screen, { title: "Presence Updated", borderColor: color, children: _jsxs(Text, { children: ["Status set to: ", _jsx(Text, { bold: true, color: color, children: status.toUpperCase() })] }) }));
|
|
49
51
|
}
|
|
50
|
-
return _jsx(
|
|
52
|
+
return _jsx(Loader, { text: "Processing..." });
|
|
51
53
|
};
|
|
52
54
|
//# sourceMappingURL=Presence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Presence.js","sourceRoot":"","sources":["../../src/commands/Presence.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Presence.js","sourceRoot":"","sources":["../../src/commands/Presence.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,GAAG,MAAM,WAAW,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAM3E,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAC5D,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;IAC9D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,WAAW;YAAE,OAAO;QAExB,IAAI,CAAC,eAAe,EAAE,CAAC;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AC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAChH,OAAO,CACH,KAAC,MAAM,IAAC,KAAK,EAAC,kBAAkB,EAAC,WAAW,EAAE,KAAK,YAC/C,MAAC,IAAI,kCACc,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAE,KAAK,YAAG,MAAM,CAAC,WAAW,EAAE,GAAQ,IAClE,GACF,CACZ,CAAC;IACN,CAAC;IAED,OAAO,KAAC,MAAM,IAAC,IAAI,EAAC,eAAe,GAAG,CAAC;AAC3C,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privacy.d.ts","sourceRoot":"","sources":["../../src/commands/Privacy.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Privacy.d.ts","sourceRoot":"","sources":["../../src/commands/Privacy.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,OAAO,+CA6CnB,CAAC"}
|
package/dist/commands/Privacy.js
CHANGED
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useAsyncRequest } from '../shared/hooks/useAsyncRequest.js';
|
|
4
|
+
import { Screen, Loader, ErrorState } from '../shared/components/index.js';
|
|
5
|
+
import { useEscapeKey } from '../shared/hooks/useEscapeKey.js';
|
|
5
6
|
export const Privacy = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const fetchSettings = async () => {
|
|
17
|
-
try {
|
|
18
|
-
const { data } = await api.get('/settings');
|
|
19
|
-
setSettings(data.privacy);
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
setError(err.response?.data?.message || 'Failed to fetch settings');
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
setLoading(false);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
fetchSettings();
|
|
29
|
-
}, []);
|
|
7
|
+
useEscapeKey();
|
|
8
|
+
// Often settings are nested in a user object or at root. The previous code accessed `data.privacy`.
|
|
9
|
+
// We'll trust the previous logic's path: GET /settings -> data.privacy
|
|
10
|
+
// BUT useAsyncRequest returns `data` as the response body.
|
|
11
|
+
// So we might need to map it or verify the endpoint structure.
|
|
12
|
+
// Assuming /settings returns { privacy: ... } based on previous code.
|
|
13
|
+
const { data: responseData, loading, error } = useAsyncRequest('/settings');
|
|
14
|
+
const settings = responseData?.privacy;
|
|
30
15
|
if (loading)
|
|
31
|
-
return _jsx(
|
|
16
|
+
return _jsx(Loader, { text: "Loading privacy settings..." });
|
|
32
17
|
if (error)
|
|
33
|
-
return
|
|
18
|
+
return _jsx(ErrorState, { error: error });
|
|
34
19
|
if (!settings)
|
|
35
|
-
return _jsx(
|
|
36
|
-
return (
|
|
20
|
+
return _jsx(ErrorState, { error: "No settings found." });
|
|
21
|
+
return (_jsx(Screen, { title: "Privacy Settings", borderColor: "yellow", children: _jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { justifyContent: "space-between", width: 40, children: [_jsx(Text, { children: "Profile Visibility:" }), _jsx(Text, { bold: true, color: "cyan", children: settings.profileVisibility })] }), _jsxs(Box, { justifyContent: "space-between", width: 40, children: [_jsx(Text, { children: "Message Settings:" }), _jsx(Text, { bold: true, color: "cyan", children: settings.messageSettings })] }), _jsxs(Box, { justifyContent: "space-between", width: 40, children: [_jsx(Text, { children: "Show Online Status:" }), _jsx(Text, { bold: true, color: "cyan", children: settings.showOnlineStatus ? 'Yes' : 'No' })] }), _jsxs(Box, { justifyContent: "space-between", width: 40, children: [_jsx(Text, { children: "Allow Tagging:" }), _jsx(Text, { bold: true, color: "cyan", children: settings.allowTagging ? 'Yes' : 'No' })] })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", italic: true, children: "Use 'hackmate settings' to modify these settings." }) })] }) }));
|
|
37
22
|
};
|
|
38
23
|
//# sourceMappingURL=Privacy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privacy.js","sourceRoot":"","sources":["../../src/commands/Privacy.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Privacy.js","sourceRoot":"","sources":["../../src/commands/Privacy.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAS/D,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,YAAY,EAAE,CAAC;IAEf,oGAAoG;IACpG,uEAAuE;IACvE,2DAA2D;IAC3D,+DAA+D;IAC/D,sEAAsE;IACtE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,eAAe,CAAM,WAAW,CAAC,CAAC;IAEjF,MAAM,QAAQ,GAAG,YAAY,EAAE,OAA0B,CAAC;IAE1D,IAAI,OAAO;QAAE,OAAO,KAAC,MAAM,IAAC,IAAI,EAAC,6BAA6B,GAAG,CAAC;IAClE,IAAI,KAAK;QAAE,OAAO,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;IAC/C,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAC,UAAU,IAAC,KAAK,EAAC,oBAAoB,GAAG,CAAC;IAEhE,OAAO,CACH,KAAC,MAAM,IAAC,KAAK,EAAC,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ot":"","sources":["../../src/commands/Settings.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/commands/Settings.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,+CAuDpB,CAAC"}
|
|
@@ -1,38 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useAsyncRequest } from '../shared/hooks/useAsyncRequest.js';
|
|
4
|
+
import { Screen, Loader, ErrorState } from '../shared/components/index.js';
|
|
5
|
+
import { useEscapeKey } from '../shared/hooks/useEscapeKey.js';
|
|
5
6
|
export const Settings = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
useInput((input, key) => {
|
|
11
|
-
if (key.escape) {
|
|
12
|
-
exit();
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const fetchSettings = async () => {
|
|
17
|
-
try {
|
|
18
|
-
const { data } = await api.get('/settings');
|
|
19
|
-
setPreferences(data.preferences);
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
setError(err.response?.data?.message || 'Failed to fetch preferences');
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
setLoading(false);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
fetchSettings();
|
|
29
|
-
}, []);
|
|
7
|
+
useEscapeKey();
|
|
8
|
+
// Assuming GET /settings returns structure { preferences: ... }
|
|
9
|
+
const { data: responseData, loading, error } = useAsyncRequest('/settings');
|
|
10
|
+
const preferences = responseData?.preferences;
|
|
30
11
|
if (loading)
|
|
31
|
-
return _jsx(
|
|
12
|
+
return _jsx(Loader, { text: "Loading preferences..." });
|
|
32
13
|
if (error)
|
|
33
|
-
return
|
|
14
|
+
return _jsx(ErrorState, { error: error });
|
|
15
|
+
// If no preferences returned, show alert
|
|
34
16
|
if (!preferences)
|
|
35
|
-
return _jsx(
|
|
36
|
-
return (
|
|
17
|
+
return _jsx(ErrorState, { error: "No preferences found." });
|
|
18
|
+
return (_jsx(Screen, { title: "Preferences", borderColor: "blue", children: _jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, underline: true, children: "Notifications" }) }), _jsxs(Box, { flexDirection: "column", marginLeft: 1, marginBottom: 1, children: [_jsxs(Box, { justifyContent: "space-between", width: 30, children: [_jsx(Text, { children: "Email:" }), _jsx(Text, { color: preferences.notifications.email ? 'green' : 'red', children: preferences.notifications.email ? 'Enabled' : 'Disabled' })] }), _jsxs(Box, { justifyContent: "space-between", width: 30, children: [_jsx(Text, { children: "Push:" }), _jsx(Text, { color: preferences.notifications.push ? 'green' : 'red', children: preferences.notifications.push ? 'Enabled' : 'Disabled' })] }), _jsxs(Box, { justifyContent: "space-between", width: 30, children: [_jsx(Text, { children: "In-App:" }), _jsx(Text, { color: preferences.notifications.inApp ? 'green' : 'red', children: preferences.notifications.inApp ? 'Enabled' : 'Disabled' })] })] }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, underline: true, children: "Localization" }) }), _jsxs(Box, { flexDirection: "column", marginLeft: 1, children: [_jsxs(Box, { justifyContent: "space-between", width: 30, children: [_jsx(Text, { children: "Language:" }), _jsx(Text, { bold: true, color: "cyan", children: preferences.language })] }), _jsxs(Box, { justifyContent: "space-between", width: 30, children: [_jsx(Text, { children: "Timezone:" }), _jsx(Text, { bold: true, color: "cyan", children: preferences.timezone })] })] })] }) }));
|
|
37
19
|
};
|
|
38
20
|
//# sourceMappingURL=Settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/commands/Settings.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Settings.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I,4BAAiB,EACtB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,YAAE,WAAW,CAAC,QAAQ,GAAQ,IACnD,IACJ,IACJ,GACD,CACZ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/commands/Stats.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stats.d.ts","sourceRoot":"","sources":["../../src/commands/Stats.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,KAAK,+CA8BjB,CAAC"}
|
package/dist/commands/Stats.js
CHANGED
|
@@ -1,38 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useAsyncRequest } from '../shared/hooks/useAsyncRequest.js';
|
|
4
|
+
import { Screen, Loader, ErrorState } from '../shared/components/index.js';
|
|
5
|
+
import { useEscapeKey } from '../shared/hooks/useEscapeKey.js';
|
|
5
6
|
export const Stats = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const [error, setError] = useState(null);
|
|
10
|
-
useInput((input, key) => {
|
|
11
|
-
if (key.escape) {
|
|
12
|
-
exit();
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
const fetchStats = async () => {
|
|
17
|
-
try {
|
|
18
|
-
const { data } = await api.get('/profile/stats');
|
|
19
|
-
setStats(data);
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
setError(err.response?.data?.message || 'Failed to fetch stats');
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
setLoading(false);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
fetchStats();
|
|
29
|
-
}, []);
|
|
7
|
+
// Standard exit handler
|
|
8
|
+
useEscapeKey();
|
|
9
|
+
const { data: stats, loading, error } = useAsyncRequest('/profile/stats');
|
|
30
10
|
if (loading)
|
|
31
|
-
return _jsx(
|
|
11
|
+
return _jsx(Loader, { text: "Calculating your stats..." });
|
|
32
12
|
if (error)
|
|
33
|
-
return
|
|
13
|
+
return _jsx(ErrorState, { error: error });
|
|
14
|
+
// Fallback if data is null/missing (unlikely with successful req but good practice)
|
|
34
15
|
if (!stats)
|
|
35
|
-
return _jsx(
|
|
36
|
-
return (
|
|
16
|
+
return _jsx(ErrorState, { error: "No stats data returned." });
|
|
17
|
+
return (_jsx(Screen, { title: "Your Stats", borderColor: "cyan", children: _jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Box, { borderStyle: "single", borderColor: "magenta", paddingX: 1, marginBottom: 1, justifyContent: "center", children: _jsxs(Text, { children: ["\uD83D\uDD25 Streak: ", _jsxs(Text, { bold: true, color: "yellow", children: [stats.streak, " days"] })] }) }), _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["\u2B50 Reputation: ", _jsxs(Text, { bold: true, color: "green", children: [stats.reputation, "+"] })] }), _jsxs(Text, { children: ["\uD83D\uDC41\uFE0F Profile Views: ", _jsx(Text, { bold: true, color: "blue", children: stats.profileViews })] }), _jsxs(Text, { children: ["\uD83E\uDD1D Connections: ", _jsx(Text, { bold: true, color: "magenta", children: stats.connectionsCount })] }), _jsxs(Text, { children: ["\uD83D\uDCAC Messages Sent: ", _jsx(Text, { bold: true, color: "green", children: stats.messagesCount })] }), _jsxs(Text, { children: ["\uD83D\uDE80 Projects: ", _jsx(Text, { bold: true, color: "cyan", children: stats.projectsCount })] }), _jsxs(Text, { children: ["\uD83D\uDC65 Groups: ", _jsx(Text, { bold: true, color: "yellow", children: stats.groupsCount })] })] })] }) }));
|
|
37
18
|
};
|
|
38
19
|
//# sourceMappingURL=Stats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../src/commands/Stats.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../src/commands/Stats.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAY/D,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE;IACtB,wBAAwB;IACxB,YAAY,EAAE,CAAC;IAEf,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,eAAe,CAAY,gBAAgB,CAAC,CAAC;IAErF,IAAI,OAAO;QAAE,OAAO,KAAC,MAAM,IAAC,IAAI,EAAC,2BAA2B,GAAG,CAAC;IAChE,IAAI,KAAK;QAAE,OAAO,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;IAE/C,oFAAoF;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,KAAC,UAAU,IAAC,KAAK,EAAC,yBAAyB,GAAG,CAAC;IAElE,OAAO,CACH,KAAC,MAAM,IAAC,KAAK,EAAC,YAAY,EAAC,WAAW,EAAC,MAAM,YACzC,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,aACnC,KAAC,GAAG,IAAC,WAAW,EAAC,QAAQ,EAAC,WAAW,EAAC,SAAS,EAAC,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,cAAc,EAAC,QAAQ,YACjG,MAAC,IAAI,wCAAY,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,QAAQ,aAAE,KAAK,CAAC,MAAM,aAAa,IAAO,GAC1E,EAEN,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,aACvB,MAAC,IAAI,wCAAiB,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,aAAE,KAAK,CAAC,UAAU,SAAS,IAAO,EAChF,MAAC,IAAI,sDAAqB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,YAAE,KAAK,CAAC,YAAY,GAAQ,IAAO,EACpF,MAAC,IAAI,+CAAmB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,SAAS,YAAE,KAAK,CAAC,gBAAgB,GAAQ,IAAO,EACzF,MAAC,IAAI,+CAAmB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,YAAE,KAAK,CAAC,aAAa,GAAQ,IAAO,EACpF,MAAC,IAAI,+CAAmB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,YAAE,KAAK,CAAC,aAAa,GAAQ,IAAO,EACnF,MAAC,IAAI,+CAAmB,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,QAAQ,YAAE,KAAK,CAAC,WAAW,GAAQ,IAAO,IACjF,IACJ,GACD,CACZ,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/features/chat/components/ChatList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../src/features/chat/components/ChatList.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,QAAQ,+CAgEpB,CAAC"}
|