@dhiraj0720/report1chart 2.4.0 → 2.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhiraj0720/report1chart",
3
- "version": "2.4.0",
3
+ "version": "2.5.1",
4
4
  "main": "src/index.jsx",
5
5
  "scripts": {
6
6
  "test": "echo 'No tests'"
@@ -0,0 +1,53 @@
1
+ import React from 'react';
2
+ import { View, Text, ScrollView, StyleSheet } from 'react-native';
3
+
4
+ const Arrow = ({ value }) => (
5
+ <Text style={{ color: value >= 0 ? 'green' : 'red', fontWeight: '700' }}>
6
+ {value >= 0 ? '↑' : '↓'} {Math.abs(value)}%
7
+ </Text>
8
+ );
9
+
10
+ const Cell = ({ children, bold }) => (
11
+ <View style={styles.cell}>
12
+ <Text style={[bold && styles.bold]}>{children}</Text>
13
+ </View>
14
+ );
15
+
16
+ const FrozenTableReport1A = ({ rows }) => {
17
+ return (
18
+ <View style={styles.container}>
19
+ {/* LEFT FROZEN COLUMN */}
20
+ <View style={styles.frozen}>
21
+ <Cell bold>FAALİYET</Cell>
22
+ {rows.map((r, i) => (
23
+ <Cell key={i} bold>{r.name}</Cell>
24
+ ))}
25
+ </View>
26
+
27
+ {/* SCROLLABLE */}
28
+ <ScrollView horizontal>
29
+ <View>
30
+ <View style={styles.headerRow}>
31
+ <Cell bold>2024</Cell>
32
+ <Cell bold>2025</Cell>
33
+ <Cell bold>Artış %</Cell>
34
+ <Cell bold>2025 Bütçe</Cell>
35
+ <Cell bold>Sapma %</Cell>
36
+ </View>
37
+
38
+ {rows.map((r, i) => (
39
+ <View key={i} style={styles.row}>
40
+ <Cell>{r.actual2024}</Cell>
41
+ <Cell>{r.actual2025}</Cell>
42
+ <Cell><Arrow value={r.actualChangePercent} /></Cell>
43
+ <Cell>{r.budget2025}</Cell>
44
+ <Cell><Arrow value={r.budgetVariancePercent} /></Cell>
45
+ </View>
46
+ ))}
47
+ </View>
48
+ </ScrollView>
49
+ </View>
50
+ );
51
+ };
52
+
53
+ export default FrozenTableReport1A;
@@ -0,0 +1,35 @@
1
+ import React, { useState } from 'react';
2
+ import { Modal, View, Text, TouchableOpacity, Dimensions } from 'react-native';
3
+ import FrozenTableReport1A from './FrozenTableReport1A';
4
+
5
+ const FullScreenTableModal = ({ visible, rows, onClose }) => {
6
+ const [landscape, setLandscape] = useState(false);
7
+ const { width, height } = Dimensions.get('window');
8
+
9
+ return (
10
+ <Modal visible={visible} animationType="slide">
11
+ <View style={{ flex: 1, padding: 16 }}>
12
+ {/* TOP BAR */}
13
+ <View style={{
14
+ flexDirection: 'row',
15
+ justifyContent: 'space-between',
16
+ marginBottom: 8,
17
+ }}>
18
+ <TouchableOpacity onPress={onClose}>
19
+ <Text style={{ fontSize: 18 }}>✕</Text>
20
+ </TouchableOpacity>
21
+
22
+ <TouchableOpacity onPress={() => setLandscape(!landscape)}>
23
+ <Text style={{ fontWeight: '700' }}>⟳ Rotate</Text>
24
+ </TouchableOpacity>
25
+ </View>
26
+
27
+ <View style={{ flex: 1 }}>
28
+ <FrozenTableReport1A rows={rows} />
29
+ </View>
30
+ </View>
31
+ </Modal>
32
+ );
33
+ };
34
+
35
+ export default FullScreenTableModal;
@@ -35,4 +35,5 @@ const styles = StyleSheet.create({
35
35
  },
36
36
  active: { backgroundColor: '#0f172a' },
37
37
  text: { color: '#000', fontWeight: '600' },
38
+ activeText: { color: '#fff', fontWeight: '700' },
38
39
  });
@@ -23,7 +23,7 @@ const styles = StyleSheet.create({
23
23
  },
24
24
  container: {
25
25
  flex: 1,
26
- paddingBottom: Platform.OS === 'android' ? 24 : 0,
27
- paddingTop: Platform.OS === 'android' ? 24 : 0,
26
+ paddingBottom: Platform.OS === 'android' ? 50 : 0,
27
+ paddingTop: Platform.OS === 'android' ? 30 : 0,
28
28
  },
29
29
  });
package/src/index.jsx CHANGED
@@ -6,7 +6,7 @@ import Report1Screen from './screens/Report1Screen';
6
6
  import Report2Screen from './screens/Report2Screen';
7
7
  import Report3Screen from './screens/Report3Screen';
8
8
 
9
- const AnalyticsReports = ({ config }) => {
9
+ const AnalyticsReports = ({ config, onExit }) => {
10
10
  const [active, setActive] = useState(null);
11
11
  const [loading, setLoading] = useState(true);
12
12
 
@@ -38,7 +38,7 @@ const AnalyticsReports = ({ config }) => {
38
38
  if (!active) {
39
39
  return (
40
40
  <SafeScreen>
41
- <ReportListScreen onSelect={setActive} />
41
+ <ReportListScreen onSelect={setActive} onExit={onExit}/>
42
42
  </SafeScreen>
43
43
  );
44
44
  }
@@ -57,6 +57,19 @@ const AnalyticsReports = ({ config }) => {
57
57
  );
58
58
  }
59
59
 
60
+ if (active === '1A') {
61
+ return (
62
+ <SafeScreen>
63
+ <Report1AScreen
64
+ endpoint={config.report1.url}
65
+ token={config.token}
66
+ onBack={() => setActive(null)}
67
+ />
68
+ </SafeScreen>
69
+ );
70
+ }
71
+
72
+
60
73
  // 👉 REPORT 2
61
74
  if (active === 2) {
62
75
  return (
@@ -0,0 +1,59 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { ScrollView, Text, TouchableOpacity } from 'react-native';
3
+ import fetchReport1 from '../api/report1Fetcher';
4
+ import FrozenTableReport1A from '../components/FrozenTableReport1A';
5
+ import Report1Card from '../components/Report1Card';
6
+ import FullScreenTableModal from '../components/FullScreenTableModal';
7
+
8
+ const Report1AScreen = ({ endpoint, token, onBack }) => {
9
+ const [rows, setRows] = useState([]);
10
+ const [fullscreen, setFullscreen] = useState(false);
11
+
12
+ useEffect(() => {
13
+ fetchReport1(endpoint, token).then(setRows);
14
+ }, []);
15
+
16
+ return (
17
+ <>
18
+ <ScrollView style={{ padding: 16 }}>
19
+ <Text onPress={onBack} style={{ marginBottom: 12 }}>‹ Back</Text>
20
+
21
+ <Text style={{ fontSize: 18, fontWeight: '700', marginBottom: 12 }}>
22
+ PERFORMANS RAPORU (USD)
23
+ </Text>
24
+
25
+ {/* FULLSCREEN BUTTON */}
26
+ <TouchableOpacity
27
+ onPress={() => setFullscreen(true)}
28
+ style={{
29
+ alignSelf: 'flex-end',
30
+ marginBottom: 8,
31
+ padding: 6,
32
+ }}
33
+ >
34
+ <Text style={{ fontWeight: '700' }}>⤢ Full Screen</Text>
35
+ </TouchableOpacity>
36
+
37
+ <FrozenTableReport1A rows={rows} />
38
+
39
+ {/* BELOW TABLE → CARDS */}
40
+ <Text style={{ marginVertical: 12, fontWeight: '700' }}>
41
+ Individual Reports
42
+ </Text>
43
+
44
+ {rows.map((r, i) => (
45
+ <Report1Card key={i} item={r} />
46
+ ))}
47
+ </ScrollView>
48
+
49
+ {/* FULL SCREEN MODAL */}
50
+ <FullScreenTableModal
51
+ visible={fullscreen}
52
+ rows={rows}
53
+ onClose={() => setFullscreen(false)}
54
+ />
55
+ </>
56
+ );
57
+ };
58
+
59
+ export default Report1AScreen;
@@ -1,15 +1,144 @@
1
1
  import React from 'react';
2
- import { View } from 'react-native';
3
- import ReportCard from '../components/ReportCard';
2
+ import {
3
+ View,
4
+ Text,
5
+ TouchableOpacity,
6
+ StyleSheet,
7
+ ScrollView,
8
+ } from 'react-native';
4
9
 
5
- const ReportListScreen = ({ onSelect }) => {
10
+ const REPORTS = [
11
+ {
12
+ id: 1,
13
+ title: 'Report 1',
14
+ desc: 'Performans Raporu (USD)',
15
+ },
16
+ {
17
+ id: '1A',
18
+ title: 'Report 1 A',
19
+ desc: 'Tablo Bazlı Performans (Detaylı)',
20
+ },
21
+ {
22
+ id: 2,
23
+ title: 'Report 2',
24
+ desc: 'Gross Profit by Company & Division',
25
+ },
26
+ {
27
+ id: '2A',
28
+ title: 'Report 2 A',
29
+ desc: 'Compact / Alternate View',
30
+ },
31
+ {
32
+ id: 3,
33
+ title: 'Report 3',
34
+ desc: 'Transportation Business Analysis',
35
+ },
36
+ {
37
+ id: '3A',
38
+ title: 'Report 3 A',
39
+ desc: 'Monthly & Budget Comparison',
40
+ },
41
+ ];
42
+
43
+ const ReportListScreen = ({ onSelect, onExit }) => {
6
44
  return (
7
- <View style={{ padding: 16 }}>
8
- <ReportCard title="Report 1" onPress={() => onSelect(1)} />
9
- <ReportCard title="Report 2" onPress={() => onSelect(2)} />
10
- <ReportCard title="Report 3" onPress={() => onSelect(3)} />
45
+ <View style={styles.container}>
46
+ {/* HEADER */}
47
+ <View style={styles.header}>
48
+ <TouchableOpacity
49
+ onPress={onExit}
50
+ style={styles.backBtn}
51
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
52
+ >
53
+ <Text style={styles.back}>‹</Text>
54
+ </TouchableOpacity>
55
+
56
+ <Text style={styles.title}>Analytics Reports</Text>
57
+
58
+ {/* Spacer */}
59
+ <View style={{ width: 28 }} />
60
+ </View>
61
+
62
+ {/* REPORT CARDS */}
63
+ <ScrollView showsVerticalScrollIndicator={false}>
64
+ {REPORTS.map(report => (
65
+ <TouchableOpacity
66
+ key={report.id}
67
+ style={styles.card}
68
+ onPress={() => onSelect(report.id)}
69
+ activeOpacity={0.85}
70
+ >
71
+ <Text style={styles.cardTitle}>{report.title}</Text>
72
+ <Text style={styles.cardDesc}>{report.desc}</Text>
73
+ </TouchableOpacity>
74
+ ))}
75
+ </ScrollView>
11
76
  </View>
12
77
  );
13
78
  };
14
79
 
15
80
  export default ReportListScreen;
81
+
82
+ const styles = StyleSheet.create({
83
+ container: {
84
+ flex: 1,
85
+ backgroundColor: '#f4f6f8',
86
+ padding: 16,
87
+ },
88
+
89
+ /* HEADER */
90
+ header: {
91
+ flexDirection: 'row',
92
+ alignItems: 'center',
93
+ marginBottom: 20,
94
+ },
95
+
96
+ backBtn: {
97
+ width: 28,
98
+ alignItems: 'flex-start',
99
+ },
100
+
101
+ back: {
102
+ fontSize: 28,
103
+ fontWeight: '700',
104
+ color: '#111',
105
+ },
106
+
107
+ title: {
108
+ flex: 1,
109
+ textAlign: 'center',
110
+ fontSize: 18,
111
+ fontWeight: '700',
112
+ color: '#111',
113
+ },
114
+
115
+ /* CARDS */
116
+ card: {
117
+ backgroundColor: '#fff',
118
+ padding: 18,
119
+ borderRadius: 14,
120
+ marginBottom: 14,
121
+
122
+ borderWidth: 1,
123
+ borderColor: '#e0e0e0',
124
+
125
+ shadowColor: '#000',
126
+ shadowOpacity: 0.06,
127
+ shadowRadius: 8,
128
+ shadowOffset: { width: 0, height: 3 },
129
+ elevation: 2,
130
+ },
131
+
132
+ cardTitle: {
133
+ fontSize: 16,
134
+ fontWeight: '700',
135
+ marginBottom: 6,
136
+ color: '#111',
137
+ },
138
+
139
+ cardDesc: {
140
+ fontSize: 13,
141
+ color: '#555',
142
+ lineHeight: 18,
143
+ },
144
+ });