codebybrody commited on
Commit
03aff49
·
verified ·
1 Parent(s): 2754f1c

Upload 61 files

Browse files
App.tsx CHANGED
@@ -855,67 +855,71 @@ const App: React.FC = () => {
855
  <>
856
  {view === 'LIST' && (
857
  <>
858
- {/* Contenedor de Navegación (Flujo normal del documento, subido con margen negativo corto) */}
859
- {(currentFolderId !== null || (isShowBreadcrumbsEnabled && isFoldersPlusEnabled)) && (
860
- <div className="flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4 mb-5 -mt-3 sm:-mt-4">
861
- {currentFolderId !== null && (
862
- <button
863
- onClick={() => {
864
- if (breadcrumbs.length > 1) {
865
- setCurrentFolderId(breadcrumbs[breadcrumbs.length - 2].id);
866
- } else {
867
- setCurrentFolderId(null);
868
- }
869
- setCurrentPage(1);
870
- }}
871
- className="flex items-center justify-center sm:justify-start gap-2 px-3 py-1.5 rounded-lg bg-surface hover:bg-white/10 text-gray-300 hover:text-white transition-all text-sm font-medium border border-white/5 w-fit shadow-sm"
872
- >
873
- <ChevronLeft size={16} /> Volver
874
- </button>
875
- )}
876
-
877
- {isShowBreadcrumbsEnabled && (
878
- <div className="flex items-center gap-1 text-sm text-gray-400 overflow-x-auto pb-1 sm:pb-0 custom-scrollbar w-max max-w-full">
879
  <button
880
  onClick={() => {
881
- setCurrentFolderId(null);
 
 
 
 
882
  setCurrentPage(1);
883
  }}
884
- className={`hover:text-white transition-colors px-2 py-1 rounded-md hover:bg-white/5 ${currentFolderId === null ? 'text-white font-bold' : ''}`}
885
  >
886
- Raíz
887
  </button>
888
- {breadcrumbs.map((crumb) => (
889
- <React.Fragment key={crumb.id}>
890
- <ChevronRight size={14} className="opacity-50 shrink-0" />
891
- <button
892
- onClick={() => {
893
- setCurrentFolderId(crumb.id);
894
- setCurrentPage(1);
895
- }}
896
- className={`hover:text-white transition-colors whitespace-nowrap px-2 py-1 rounded-md hover:bg-white/5 ${currentFolderId === crumb.id ? 'text-white font-bold' : ''}`}
897
- >
898
- {crumb.title}
899
- </button>
900
- </React.Fragment>
901
- ))}
902
- </div>
903
- )}
904
- </div>
905
- )}
906
-
907
- {filteredItems.length === 0 ? (
908
- <div className="text-center py-20 opacity-50">
909
- <div className="inline-block p-6 rounded-full bg-surface mb-4">
910
- <Search size={48} className="text-gray-600" />
 
 
 
 
 
 
911
  </div>
 
 
 
 
 
 
 
 
 
 
912
  <h3 className="text-xl font-medium">No se encontraron elementos</h3>
913
  <p className="text-gray-500 mt-2">El repositorio está vacío o no hay coincidencias.</p>
914
  </div>
915
  ) : (
916
  <>
917
  <div
918
- className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"
919
  >
920
  {paginatedItems.map(item => (
921
  <Card
 
855
  <>
856
  {view === 'LIST' && (
857
  <>
858
+ {/* Contenedor de Navegación Estable (Reserva espacio para evitar saltos de layout) */}
859
+ <div className="min-h-[40px] mb-5">
860
+ {(currentFolderId !== null || (isShowBreadcrumbsEnabled && isFoldersPlusEnabled)) && (
861
+ <div className="flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4 -mt-3 sm:-mt-4">
862
+ {currentFolderId !== null && (
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
  <button
864
  onClick={() => {
865
+ if (breadcrumbs.length > 1) {
866
+ setCurrentFolderId(breadcrumbs[breadcrumbs.length - 2].id);
867
+ } else {
868
+ setCurrentFolderId(null);
869
+ }
870
  setCurrentPage(1);
871
  }}
872
+ className="flex items-center justify-center sm:justify-start gap-2 px-3 py-1.5 rounded-lg bg-surface hover:bg-white/10 text-gray-300 hover:text-white transition-all text-sm font-medium border border-white/5 w-fit shadow-sm shrink-0"
873
  >
874
+ <ChevronLeft size={16} /> Volver
875
  </button>
876
+ )}
877
+
878
+ {isShowBreadcrumbsEnabled && (
879
+ <div className="flex items-center gap-1 text-sm text-gray-400 overflow-x-auto pb-1 sm:pb-0 custom-scrollbar w-max max-w-full">
880
+ <button
881
+ onClick={() => {
882
+ setCurrentFolderId(null);
883
+ setCurrentPage(1);
884
+ }}
885
+ className={`hover:text-white transition-colors px-2 py-1 rounded-md hover:bg-white/5 ${currentFolderId === null ? 'text-white font-bold' : ''}`}
886
+ >
887
+ Raíz
888
+ </button>
889
+ {breadcrumbs.map((crumb) => (
890
+ <React.Fragment key={crumb.id}>
891
+ <ChevronRight size={14} className="opacity-50 shrink-0" />
892
+ <button
893
+ onClick={() => {
894
+ setCurrentFolderId(crumb.id);
895
+ setCurrentPage(1);
896
+ }}
897
+ className={`hover:text-white transition-colors whitespace-nowrap px-2 py-1 rounded-md hover:bg-white/5 ${currentFolderId === crumb.id ? 'text-white font-bold' : ''}`}
898
+ >
899
+ {crumb.title}
900
+ </button>
901
+ </React.Fragment>
902
+ ))}
903
+ </div>
904
+ )}
905
  </div>
906
+ )}
907
+ </div>
908
+ </>
909
+ )}
910
+
911
+ {filteredItems.length === 0 ? (
912
+ <div className="text-center py-20 opacity-50">
913
+ <div className="inline-block p-6 rounded-full bg-surface mb-4">
914
+ <Search size={48} className="text-gray-600" />
915
+ </div>
916
  <h3 className="text-xl font-medium">No se encontraron elementos</h3>
917
  <p className="text-gray-500 mt-2">El repositorio está vacío o no hay coincidencias.</p>
918
  </div>
919
  ) : (
920
  <>
921
  <div
922
+ className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3 items-start"
923
  >
924
  {paginatedItems.map(item => (
925
  <Card
components/Card.tsx CHANGED
@@ -1,7 +1,8 @@
1
- import React from 'react';
2
  import { DataItem } from '../types';
3
- import { Download, ExternalLink, Check, Folder, Pin } from 'lucide-react';
4
  import { getIconComponent } from './IconPicker';
 
5
 
6
  interface CardProps {
7
  item: DataItem;
@@ -15,7 +16,23 @@ interface CardProps {
15
 
16
  export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelected, onMouseDown, onMouseEnter, onDoubleClick }) => {
17
  const Icon = getIconComponent(item.icon);
18
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  if (item.isFolder) {
20
  return (
21
  <div
@@ -23,28 +40,32 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
23
  onDoubleClick={() => onDoubleClick?.(item)}
24
  onMouseDown={(e) => onMouseDown?.(e, item)}
25
  onMouseEnter={(e) => onMouseEnter?.(e, item)}
26
- style={{ userSelect: isSelectable ? 'none' : 'auto' }}
27
- className={`relative group bg-surface border ${isSelected ? 'border-primary ring-2 ring-primary bg-primary/10 shadow-[0_0_20px_rgba(187,134,252,0.15)]' : 'border-white/5 hover:border-primary/30 hover:bg-white/[0.02]'} rounded-xl p-6 cursor-pointer transition-all duration-300 ${isSelected ? 'scale-[0.98]' : 'hover:-translate-y-1 hover:shadow-xl'} flex flex-col items-center justify-center h-[260px] text-center overflow-hidden`}
 
 
 
28
  >
29
  {isSelected && (
30
- <div className="absolute top-3 right-3 z-20 w-6 h-6 bg-primary rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
31
- <Check size={14} className="text-[#121212]" strokeWidth={3} />
32
  </div>
33
  )}
34
  {item.isPinned && (
35
- <div className="absolute top-3 left-3 z-20 w-6 h-6 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
36
- <Pin size={12} className="text-primary fill-primary" />
37
  </div>
38
  )}
39
- <div className="p-4 bg-white/5 rounded-2xl mb-4 group-hover:bg-primary/10 transition-colors">
40
- <Folder size={48} className="text-primary opacity-80 group-hover:opacity-100 transition-opacity" strokeWidth={1} />
 
41
  </div>
42
- <h3 className="text-lg font-bold text-white group-hover:text-primary transition-colors line-clamp-2 w-full px-2">
43
- {item.title}
 
 
 
44
  </h3>
45
- {item.summary && item.summary !== 'Carpeta' && (
46
- <p className="text-xs text-gray-500 mt-2 line-clamp-1 break-words">{item.summary}</p>
47
- )}
48
  </div>
49
  );
50
  }
@@ -57,41 +78,46 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
57
  onDoubleClick={() => onDoubleClick?.(item)}
58
  onMouseDown={(e) => onMouseDown?.(e, item)}
59
  onMouseEnter={(e) => onMouseEnter?.(e, item)}
60
- style={{ userSelect: isSelectable ? 'none' : 'auto' }}
61
- className={`relative group bg-surface border ${isSelected ? 'border-primary ring-2 ring-primary bg-primary/10 shadow-[0_0_20px_rgba(187,134,252,0.15)]' : 'border-white/5 hover:border-primary/30'} rounded-xl p-3 sm:p-4 cursor-pointer transition-all duration-300 ${isSelected ? 'scale-[0.98]' : 'hover:-translate-y-1 hover:shadow-xl'} flex flex-col h-[260px] overflow-hidden`}
 
 
 
62
  >
63
  {isSelected && (
64
- <div className="absolute top-3 right-3 z-20 w-6 h-6 bg-primary rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
65
- <Check size={14} className="text-[#121212]" strokeWidth={3} />
66
  </div>
67
  )}
68
  {item.isPinned && (
69
- <div className="absolute top-3 left-3 z-20 w-6 h-6 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
70
- <Pin size={12} className="text-primary fill-primary" />
71
  </div>
72
  )}
73
- <div className="mb-2 flex-grow flex flex-col">
74
- <div className="flex items-start gap-2">
75
  {Icon && (
76
  <div className="text-primary shrink-0 mt-0.5">
77
- <Icon size={18} className="sm:w-5 sm:h-5" />
78
  </div>
79
  )}
80
  <h3
81
- className="text-sm sm:text-base font-bold text-white mb-2 group-hover:text-primary transition-colors break-words line-clamp-2"
82
- title={(item.title || '').replace(/<[^>]*>?/gm, '')}
 
83
  >
84
- {(item.title || '').replace(/<[^>]*>?/gm, '').replace(/&nbsp;/g, ' ')}
85
  </h3>
86
  </div>
87
  <div
88
- className="text-zinc-400 text-[10px] sm:text-[11px] leading-relaxed [&>p]:m-0 [&_img]:hidden [&_figure]:hidden overflow-hidden flex-grow"
89
  dangerouslySetInnerHTML={{ __html: item.summary }}
90
  style={{
91
  display: '-webkit-box',
92
- WebkitLineClamp: (item.visitUrl || item.downloadUrl) ? 4 : 8,
93
  WebkitBoxOrient: 'vertical',
94
- overflow: 'hidden'
 
95
  }}
96
  />
97
  </div>
@@ -100,16 +126,16 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
100
 
101
  {/* Buttons Section */}
102
  {(item.visitUrl || item.downloadUrl) && (
103
- <div className="mt-auto flex flex-col sm:flex-row gap-2 pt-2">
104
  {item.visitUrl && (
105
  <a
106
  href={item.visitUrl}
107
  target="_blank"
108
  rel="noopener noreferrer"
109
  onClick={(e) => e.stopPropagation()}
110
- className={`flex-1 w-full bg-transparent border border-[#bb86fc] text-[#bb86fc] font-medium py-1.5 px-3 rounded-lg flex items-center justify-center gap-2 hover:bg-[#bb86fc] hover:text-[#121212] transition-all text-xs shadow-[0_0_5px_rgba(187,134,252,0.2)]`}
111
  >
112
- <ExternalLink size={12} strokeWidth={2.5} />
113
  Visitar
114
  </a>
115
  )}
@@ -120,9 +146,9 @@ export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelec
120
  target="_blank"
121
  rel="noopener noreferrer"
122
  onClick={(e) => e.stopPropagation()}
123
- className={`flex-1 w-full bg-transparent border border-[#bb86fc] text-[#bb86fc] font-medium py-1.5 px-3 rounded-lg flex items-center justify-center gap-2 hover:bg-[#bb86fc] hover:text-[#121212] transition-all text-xs shadow-[0_0_5px_rgba(187,134,252,0.2)]`}
124
  >
125
- <Download size={12} strokeWidth={2.5} />
126
  Descargar
127
  </a>
128
  )}
 
1
+ import React, { useState, useEffect, useRef } from 'react';
2
  import { DataItem } from '../types';
3
+ import { Download, ExternalLink, Check, Folder, Pin, Maximize2 } from 'lucide-react';
4
  import { getIconComponent } from './IconPicker';
5
+ import { subscribeToStyleConfig, DEFAULT_STYLE_CONFIG, saveStyleConfigToCloud } from '../services/codeStyleService';
6
 
7
  interface CardProps {
8
  item: DataItem;
 
16
 
17
  export const Card: React.FC<CardProps> = ({ item, onClick, isSelectable, isSelected, onMouseDown, onMouseEnter, onDoubleClick }) => {
18
  const Icon = getIconComponent(item.icon);
19
+ const [styleConfig, setStyleConfig] = useState(DEFAULT_STYLE_CONFIG);
20
+
21
+ useEffect(() => {
22
+ const unsubscribe = subscribeToStyleConfig((config) => {
23
+ setStyleConfig(config);
24
+ });
25
+ return () => unsubscribe();
26
+ }, []);
27
+
28
+ const cardStyle = {
29
+ width: '100%',
30
+ height: '190px',
31
+ };
32
+
33
+ const rawTitle = (item.title || '').replace(/<[^>]*>?/gm, '').replace(/&nbsp;/g, ' ');
34
+ const truncatedTitle = rawTitle.length > 33 ? rawTitle.substring(0, 33) + '...' : rawTitle;
35
+
36
  if (item.isFolder) {
37
  return (
38
  <div
 
40
  onDoubleClick={() => onDoubleClick?.(item)}
41
  onMouseDown={(e) => onMouseDown?.(e, item)}
42
  onMouseEnter={(e) => onMouseEnter?.(e, item)}
43
+ style={{
44
+ userSelect: isSelectable ? 'none' : 'auto',
45
+ ...cardStyle
46
+ }}
47
+ className={`relative group bg-surface border ${isSelected ? 'border-primary ring-2 ring-primary bg-primary/10 shadow-[0_0_20px_rgba(187,134,252,0.15)]' : 'border-white/5 hover:border-primary/30 hover:bg-white/[0.02]'} rounded-xl cursor-pointer transition-[border,background-color,transform,box-shadow,color] duration-300 ${isSelected ? 'scale-[0.98]' : 'hover:-translate-y-1 hover:shadow-lg'} flex flex-col items-center justify-center text-center overflow-hidden`}
48
  >
49
  {isSelected && (
50
+ <div className="absolute top-2 right-2 z-20 w-5 h-5 bg-primary rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
51
+ <Check size={12} className="text-[#121212]" strokeWidth={3} />
52
  </div>
53
  )}
54
  {item.isPinned && (
55
+ <div className="absolute top-2 left-2 z-20 w-5 h-5 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg transition-transform animate-in zoom-in duration-200 pointer-events-none">
56
+ <Pin size={10} className="text-primary fill-primary" />
57
  </div>
58
  )}
59
+ {/* Folder content stays as was before pill change */}
60
+ <div className="p-3 bg-white/5 rounded-xl mb-2 group-hover:bg-primary/10 transition-colors">
61
+ <Folder size={44} className="text-primary opacity-80 group-hover:opacity-100 transition-opacity" strokeWidth={1} />
62
  </div>
63
+ <h3
64
+ style={{ fontSize: styleConfig.general.cardTitleSize }}
65
+ className="font-bold text-white group-hover:text-primary transition-colors line-clamp-2 w-full px-2"
66
+ >
67
+ {truncatedTitle}
68
  </h3>
 
 
 
69
  </div>
70
  );
71
  }
 
78
  onDoubleClick={() => onDoubleClick?.(item)}
79
  onMouseDown={(e) => onMouseDown?.(e, item)}
80
  onMouseEnter={(e) => onMouseEnter?.(e, item)}
81
+ style={{
82
+ userSelect: isSelectable ? 'none' : 'auto',
83
+ ...cardStyle
84
+ }}
85
+ className={`relative group bg-surface border ${isSelected ? 'border-primary ring-2 ring-primary bg-primary/10 shadow-[0_0_20px_rgba(187,134,252,0.15)]' : 'border-white/5 hover:border-primary/30'} rounded-xl cursor-pointer transition-[border,background-color,transform,box-shadow,color] duration-300 ${isSelected ? 'scale-[0.98]' : 'hover:-translate-y-1'} flex flex-col overflow-hidden p-5`}
86
  >
87
  {isSelected && (
88
+ <div className="absolute top-2 right-2 z-20 w-5 h-5 bg-primary rounded-full flex items-center justify-center shadow-lg pointer-events-none">
89
+ <Check size={12} className="text-[#121212]" strokeWidth={3} />
90
  </div>
91
  )}
92
  {item.isPinned && (
93
+ <div className="absolute top-2 left-2 z-20 w-5 h-5 bg-primary/20 backdrop-blur-sm border border-primary/30 rounded-full flex items-center justify-center shadow-lg pointer-events-none">
94
+ <Pin size={10} className="text-primary fill-primary" />
95
  </div>
96
  )}
97
+ <div className="mb-1 flex-grow flex flex-col min-h-0">
98
+ <div className="flex items-start gap-2 mb-2">
99
  {Icon && (
100
  <div className="text-primary shrink-0 mt-0.5">
101
+ <Icon size={20} />
102
  </div>
103
  )}
104
  <h3
105
+ style={{ fontSize: styleConfig.general.cardTitleSize }}
106
+ className="font-bold text-white leading-tight group-hover:text-primary transition-colors break-words line-clamp-2"
107
+ title={rawTitle}
108
  >
109
+ {truncatedTitle}
110
  </h3>
111
  </div>
112
  <div
113
+ className="text-zinc-400 leading-relaxed [&>p]:m-0 [&_img]:hidden [&_figure]:hidden overflow-hidden"
114
  dangerouslySetInnerHTML={{ __html: item.summary }}
115
  style={{
116
  display: '-webkit-box',
117
+ WebkitLineClamp: 3,
118
  WebkitBoxOrient: 'vertical',
119
+ overflow: 'hidden',
120
+ fontSize: styleConfig.general.cardFontSize
121
  }}
122
  />
123
  </div>
 
126
 
127
  {/* Buttons Section */}
128
  {(item.visitUrl || item.downloadUrl) && (
129
+ <div className="mt-auto flex gap-1.5 pt-2 border-t border-white/5">
130
  {item.visitUrl && (
131
  <a
132
  href={item.visitUrl}
133
  target="_blank"
134
  rel="noopener noreferrer"
135
  onClick={(e) => e.stopPropagation()}
136
+ className={`flex-1 bg-transparent border border-primary/30 text-primary font-bold py-2 px-2 rounded-lg flex items-center justify-center gap-1.5 hover:bg-primary hover:text-background transition-all text-xs sm:text-[12px]`}
137
  >
138
+ <ExternalLink size={14} />
139
  Visitar
140
  </a>
141
  )}
 
146
  target="_blank"
147
  rel="noopener noreferrer"
148
  onClick={(e) => e.stopPropagation()}
149
+ className={`flex-1 bg-transparent border border-primary/30 text-primary font-bold py-2 px-2 rounded-lg flex items-center justify-center gap-1.5 hover:bg-primary hover:text-background transition-all text-xs sm:text-[12px]`}
150
  >
151
+ <Download size={14} />
152
  Descargar
153
  </a>
154
  )}
components/StyleSettingsPanel.tsx CHANGED
@@ -190,6 +190,54 @@ export const StyleSettingsPanel: React.FC<StyleSettingsPanelProps> = ({
190
 
191
  {activeTab === 'general' && (
192
  <div className="space-y-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  {/* Card Style Config */}
194
  <div className="bg-white/5 rounded-lg p-4 border border-white/5">
195
  <h4 className="text-sm font-medium text-white mb-2">Estilo de Tarjeta</h4>
 
190
 
191
  {activeTab === 'general' && (
192
  <div className="space-y-6">
193
+ {/* Typography Control */}
194
+ <div className="bg-white/5 rounded-lg p-4 border border-white/5 space-y-4">
195
+ <h4 className="text-sm font-medium text-white mb-2">Tipografía de Tarjeta</h4>
196
+ <div className="space-y-4">
197
+ <div>
198
+ <div className="flex justify-between mb-2">
199
+ <label className="text-[10px] text-gray-500 uppercase tracking-widest font-semibold">Tamaño Título</label>
200
+ <span className="text-xs text-primary font-mono">{localConfig.general.cardTitleSize}</span>
201
+ </div>
202
+ <input
203
+ type="range"
204
+ min="10"
205
+ max="32"
206
+ step="1"
207
+ value={parseInt(localConfig.general.cardTitleSize) || 16}
208
+ onChange={(e) => {
209
+ setLocalConfig({
210
+ ...localConfig,
211
+ general: { ...localConfig.general, cardTitleSize: `${e.target.value}px` }
212
+ });
213
+ }}
214
+ className="w-full h-1 bg-white/10 rounded-lg appearance-none cursor-pointer accent-primary"
215
+ />
216
+ </div>
217
+
218
+ <div>
219
+ <div className="flex justify-between mb-2">
220
+ <label className="text-[10px] text-gray-500 uppercase tracking-widest font-semibold">Tamaño Texto</label>
221
+ <span className="text-xs text-primary font-mono">{localConfig.general.cardFontSize}</span>
222
+ </div>
223
+ <input
224
+ type="range"
225
+ min="8"
226
+ max="24"
227
+ step="1"
228
+ value={parseInt(localConfig.general.cardFontSize) || 12}
229
+ onChange={(e) => {
230
+ setLocalConfig({
231
+ ...localConfig,
232
+ general: { ...localConfig.general, cardFontSize: `${e.target.value}px` }
233
+ });
234
+ }}
235
+ className="w-full h-1 bg-white/10 rounded-lg appearance-none cursor-pointer accent-primary"
236
+ />
237
+ </div>
238
+ </div>
239
+ </div>
240
+
241
  {/* Card Style Config */}
242
  <div className="bg-white/5 rounded-lg p-4 border border-white/5">
243
  <h4 className="text-sm font-medium text-white mb-2">Estilo de Tarjeta</h4>
services/codeStyleService.ts CHANGED
@@ -22,7 +22,12 @@ const app = initializeApp(firebaseConfig);
22
  const db = getFirestore(app);
23
  const COLLECTION_NAME = 'code_style_config';
24
 
25
- export interface GeneralConfig { }
 
 
 
 
 
26
 
27
  export interface QuoteStyleConfig {
28
  textColor: string;
@@ -79,7 +84,12 @@ export interface StyleConfig {
79
  showCopyButton: boolean;
80
  }
81
 
82
- export const DEFAULT_GENERAL_STYLE: GeneralConfig = {};
 
 
 
 
 
83
 
84
  export const DEFAULT_QUOTE_STYLE: QuoteStyleConfig = {
85
  textColor: '#9ca3af',
@@ -172,7 +182,12 @@ export const loadStyleConfigFromCloud = async (): Promise<StyleConfig | null> =>
172
  if (docSnap.exists()) {
173
  const data = docSnap.data();
174
  return {
175
- general: {},
 
 
 
 
 
176
  code: {
177
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
178
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,
@@ -235,7 +250,12 @@ export const subscribeToStyleConfig = (callback: (config: StyleConfig) => void)
235
  if (docSnap.exists()) {
236
  const data = docSnap.data();
237
  const config: StyleConfig = {
238
- general: {},
 
 
 
 
 
239
  code: {
240
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
241
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,
@@ -294,7 +314,12 @@ export const subscribeToStyleConfig = (callback: (config: StyleConfig) => void)
294
  if (docSnap.exists()) {
295
  const data = docSnap.data();
296
  const config: StyleConfig = {
297
- general: {},
 
 
 
 
 
298
  code: {
299
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
300
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,
 
22
  const db = getFirestore(app);
23
  const COLLECTION_NAME = 'code_style_config';
24
 
25
+ export interface GeneralConfig {
26
+ cardWidth: string;
27
+ cardHeight: string;
28
+ cardFontSize: string;
29
+ cardTitleSize: string;
30
+ }
31
 
32
  export interface QuoteStyleConfig {
33
  textColor: string;
 
84
  showCopyButton: boolean;
85
  }
86
 
87
+ export const DEFAULT_GENERAL_STYLE: GeneralConfig = {
88
+ cardWidth: '358px',
89
+ cardHeight: '190px',
90
+ cardFontSize: '16px',
91
+ cardTitleSize: '24px'
92
+ };
93
 
94
  export const DEFAULT_QUOTE_STYLE: QuoteStyleConfig = {
95
  textColor: '#9ca3af',
 
182
  if (docSnap.exists()) {
183
  const data = docSnap.data();
184
  return {
185
+ general: {
186
+ cardWidth: data.general?.cardWidth || DEFAULT_GENERAL_STYLE.cardWidth,
187
+ cardHeight: data.general?.cardHeight || DEFAULT_GENERAL_STYLE.cardHeight,
188
+ cardFontSize: data.general?.cardFontSize || DEFAULT_GENERAL_STYLE.cardFontSize,
189
+ cardTitleSize: data.general?.cardTitleSize || DEFAULT_GENERAL_STYLE.cardTitleSize,
190
+ },
191
  code: {
192
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
193
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,
 
250
  if (docSnap.exists()) {
251
  const data = docSnap.data();
252
  const config: StyleConfig = {
253
+ general: {
254
+ cardWidth: data.general?.cardWidth || DEFAULT_GENERAL_STYLE.cardWidth,
255
+ cardHeight: data.general?.cardHeight || DEFAULT_GENERAL_STYLE.cardHeight,
256
+ cardFontSize: data.general?.cardFontSize || DEFAULT_GENERAL_STYLE.cardFontSize,
257
+ cardTitleSize: data.general?.cardTitleSize || DEFAULT_GENERAL_STYLE.cardTitleSize,
258
+ },
259
  code: {
260
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
261
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,
 
314
  if (docSnap.exists()) {
315
  const data = docSnap.data();
316
  const config: StyleConfig = {
317
+ general: {
318
+ cardWidth: data.general?.cardWidth || DEFAULT_GENERAL_STYLE.cardWidth,
319
+ cardHeight: data.general?.cardHeight || DEFAULT_GENERAL_STYLE.cardHeight,
320
+ cardFontSize: data.general?.cardFontSize || DEFAULT_GENERAL_STYLE.cardFontSize,
321
+ cardTitleSize: data.general?.cardTitleSize || DEFAULT_GENERAL_STYLE.cardTitleSize,
322
+ },
323
  code: {
324
  textColor: data.code?.textColor || DEFAULT_CODE_STYLE.textColor,
325
  bgColor: data.code?.bgColor || DEFAULT_CODE_STYLE.bgColor,