File size: 7,243 Bytes
99be3c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
```javascript
import React from 'react';
import { Link } from 'react-router-dom';
import Sidebar from '../components/Sidebar';

const Apps = () => {
  const apps = [
    {
      id: 1,
      name: "Payment Gateway",
      type: "Web App",
      color: "purple",
      description: "Secure payment processing solution with multiple currency support.",
      updated: "2 days ago",
      image: "1"
    },
    {
      id: 2,
      name: "USSD Banking",
      type: "USSD",
      color: "blue",
      description: "Mobile banking service accessible via USSD without internet.",
      updated: "1 week ago",
      image: "2"
    },
    {
      id: 3,
      name: "Weather API",
      type: "API",
      color: "green",
      description: "Real-time weather data and forecasts API service.",
      updated: "3 days ago",
      image: "3"
    },
    {
      id: 4,
      name: "Inventory System",
      type: "Web App",
      color: "yellow",
      description: "Comprehensive inventory management system with reporting.",
      updated: "yesterday",
      image: "4"
    },
    {
      id: 5,
      name: "USSD Voting",
      type: "USSD",
      color: "red",
      description: "Mobile voting system accessible via USSD for elections.",
      updated: "2 weeks ago",
      image: "5"
    },
    {
      id: 6,
      name: "SMS Gateway API",
      type: "API",
      color: "indigo",
      description: "Bulk SMS sending and receiving API with analytics.",
      updated: "5 days ago",
      image: "6"
    }
  ];

  return (
    <div className="flex h-screen overflow-hidden bg-gray-50">
      <Sidebar active="apps" />
      
      <div className="flex-1 overflow-auto">
        <Header title="All Apps" />

        <main className="p-6">
          <div className="mb-6 bg-white rounded-lg shadow p-4">
            <div className="flex flex-col md:flex-row md:items-center md:justify-between">
              <div className="relative w-full md:w-64 mb-4 md:mb-0">
                <input type="text" placeholder="Search apps..." 
                       className="w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500" />
                <i data-feather="search" className="absolute left-3 top-2.5 text-gray-400"></i>
              </div>
              
              <div className="flex space-x-2">
                <select className="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
                  <option>All Categories</option>
                  <option>Web Apps</option>
                  <option>USSD</option>
                  <option>APIs</option>
                </select>
                
                <select className="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-purple-500">
                  <option>Sort by</option>
                  <option>Recently Added</option>
                  <option>Most Popular</option>
                  <option>A-Z</option>
                </select>
                
                <Link to="/new-app" className="bg-purple-600 text-white px-4 py-2 rounded-lg hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 flex items-center">
                  <i data-feather="plus" className="w-4 h-4 mr-1"></i>
                  New App
                </Link>
              </div>
            </div>
          </div>
          
          <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
            {apps.map(app => (
              <AppCard key={app.id} app={app} />
            ))}
          </div>
          
          <Pagination />
        </main>
      </div>
    </div>
  );
};

const Header = ({ title }) => (
  <header className="bg-white shadow-sm">
    <div className="flex justify-between items-center px-6 py-4">
      <h1 className="text-2xl font-semibold text-gray-800">{title}</h1>
      <div className="flex items-center space-x-4">
        <button className="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
          <i data-feather="bell"></i>
        </button>
        <button className="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
          <i data-feather="help-circle"></i>
        </button>
      </div>
    </div>
  </header>
);

const AppCard = ({ app }) => (
  <div className="app-card bg-white rounded-lg shadow overflow-hidden transition-all duration-200">
    <div className={`h-40 bg-${app.color}-100 flex items-center justify-center`}>
      <img 
        src={`http://static.photos/technology/640x360/${app.image}`} 
        alt="App screenshot" 
        className="h-full w-full object-cover" 
      />
    </div>
    <div className="p-5">
      <div className="flex justify-between items-start">
        <div>
          <h3 className="text-lg font-semibold text-gray-800">{app.name}</h3>
          <span className={`inline-block px-2 py-1 text-xs font-semibold rounded-full bg-${app.color}-100 text-${app.color}-800 mt-1`}>
            {app.type}
          </span>
        </div>
        <div className="flex space-x-2">
          <button className="p-2 text-gray-500 hover:text-purple-600 hover:bg-purple-50 rounded-full">
            <i data-feather="edit-2" className="w-4 h-4"></i>
          </button>
          <button className="p-2 text-gray-500 hover:text-red-600 hover:bg-red-50 rounded-full">
            <i data-feather="trash-2" className="w-4 h-4"></i>
          </button>
        </div>
      </div>
      <p className="mt-3 text-gray-600 text-sm">{app.description}</p>
      <div className="mt-4 flex justify-between items-center">
        <span className="text-xs text-gray-500">Updated {app.updated}</span>
        <a 
          href={app.type === 'USSD' ? `tel:*123#` : `https://${app.name.toLowerCase()}.example.com`} 
          target="_blank" 
          rel="noopener noreferrer"
          className={`text-sm font-medium text-${app.color}-600 hover:text-${app.color}-500 flex items-center`}
        >
          {app.type === 'USSD' ? 'Dial' : app.type === 'API' ? 'Docs' : 'Open'}
          <i data-feather={app.type === 'USSD' ? 'phone' : app.type === 'API' ? 'file-text' : 'external-link'} className="w-4 h-4 ml-1"></i>
        </a>
      </div>
    </div>
  </div>
);

const Pagination = () => (
  <div className="mt-8 flex justify-center">
    <nav className="inline-flex rounded-md shadow">
      <a href="#" className="px-3 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
        Previous
      </a>
      <a href="#" className="px-3 py-2 border-t border-b border-gray-300 bg-white text-sm font-medium text-purple-600 hover:bg-purple-50">
        1
      </a>
      <a href="#" className="px-3 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
        2
      </a>
      <a href="#" className="px-3 py-2 border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
        3
      </a>
      <a href="#" className="px-3 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
        Next
      </a>
    </nav>
  </div>
);

export default Apps;
```