|
23 | 23 | document.getElementById('toggleDetailedView')!.textContent = detailedRows[0].classList.contains('hidden') |
24 | 24 | ? 'Show Detailed View' |
25 | 25 | : 'Hide Detailed View'; |
26 | | - |
| 26 | +
|
27 | 27 | // Recheck gradient visibility after toggling detailed view |
28 | 28 | setTimeout(checkGradientVisibility, 100); |
29 | 29 | } |
30 | 30 |
|
31 | 31 | function checkGradientVisibility() { |
32 | 32 | if (!scrollContainer) return; |
33 | | - |
| 33 | +
|
34 | 34 | const isScrollable = scrollContainer.scrollWidth > scrollContainer.clientWidth; |
35 | 35 | const isScrolledToEnd = scrollContainer.scrollLeft + scrollContainer.clientWidth >= scrollContainer.scrollWidth - 1; |
36 | | - |
| 36 | +
|
37 | 37 | showGradient = isScrollable && !isScrolledToEnd; |
38 | 38 | } |
39 | 39 |
|
|
43 | 43 |
|
44 | 44 | onMount(() => { |
45 | 45 | checkGradientVisibility(); |
46 | | - |
| 46 | +
|
47 | 47 | // Also check on window resize |
48 | 48 | const handleResize = () => checkGradientVisibility(); |
49 | 49 | window.addEventListener('resize', handleResize); |
50 | | - |
| 50 | +
|
51 | 51 | return () => { |
52 | 52 | window.removeEventListener('resize', handleResize); |
53 | 53 | }; |
|
68 | 68 | Show Detailed View |
69 | 69 | </button> |
70 | 70 | <div class="table-wrapper relative"> |
71 | | - <div |
72 | | - class="w-full overflow-x-auto whitespace-nowrap" |
73 | | - bind:this={scrollContainer} |
74 | | - on:scroll={handleScroll} |
75 | | - > |
| 71 | + <div class="w-full overflow-x-auto whitespace-nowrap" bind:this={scrollContainer} on:scroll={handleScroll}> |
76 | 72 | <table class="w-full border-collapse rounded-lg bg-neutral-900"> |
77 | | - <thead> |
78 | | - <tr> |
79 | | - <th class="sticky left-0 z-10 bg-neutral-900 px-4 py-3 text-center text-base text-white">Device</th> |
80 | | - {#each features as feat} |
81 | | - <th |
82 | | - class="px-4 py-3 text-center text-base text-white {feat === 'ESP' || feat === 'Battery' || feat === 'Flash' || feat === 'PSRAM' |
83 | | - ? 'detailed hidden' |
84 | | - : ''}">{feat.replace('_', ' ')}</th |
85 | | - > |
86 | | - {/each} |
87 | | - </tr> |
88 | | - </thead> |
89 | | - <tbody> |
90 | | - {#each compatibilityData as row, index} |
91 | | - <tr class="group even:bg-neutral-800 hover:bg-neutral-700"> |
92 | | - <td class="sticky left-0 z-10 px-4 py-3 text-center text-base text-white {index % 2 === 0 ? 'bg-neutral-900' : 'bg-neutral-800'} group-hover:bg-neutral-700" |
93 | | - >{row.device}</td |
94 | | - > |
95 | | - {#each features as key} |
96 | | - <td |
97 | | - title={typeof row[key] === 'string' ? row[key] : ''} |
98 | | - class={key === 'ESP' || key === 'Battery' || key === 'Flash' || key === 'PSRAM' ? 'detailed hidden' : ''} |
| 73 | + <thead> |
| 74 | + <tr> |
| 75 | + <th class="sticky left-0 z-10 bg-neutral-900 px-4 py-3 text-center text-base text-white">Device</th> |
| 76 | + {#each features as feat} |
| 77 | + <th |
| 78 | + class="px-4 py-3 text-center text-base text-white {feat === 'Screen' || |
| 79 | + feat === 'ESP' || |
| 80 | + feat === 'Battery' || |
| 81 | + feat === 'Flash' || |
| 82 | + feat === 'PSRAM' |
| 83 | + ? 'detailed hidden' |
| 84 | + : ''}">{feat.replace('_', ' ')}</th |
99 | 85 | > |
100 | | - {#if (key === 'ESP' || key === 'Battery' || key === 'Flash' || key === 'PSRAM') && typeof row[key] === 'string'} |
101 | | - {row[key]} |
102 | | - {:else if key === 'NFC' && typeof row[key] === 'string' && row[key] !== 'Module Required'} |
103 | | - ✅ |
104 | | - {:else if key === 'Mic'} |
105 | | - {typeof row[key] === 'string' ? '✅' : '❌'} |
106 | | - {#if typeof row[key] === 'string'}<span class="detailed hidden">{row[key]}</span>{/if} |
107 | | - {:else if key === 'Audio'} |
108 | | - {row[key] === 'Tone' ? '🔈' : typeof row[key] === 'string' ? '🔊' : '❌'} |
109 | | - {#if typeof row[key] === 'string'}<span class="detailed hidden">{row[key] !== 'Tone' ? 'Full - ' : ''}{row[key]}</span>{/if} |
110 | | - {:else} |
111 | | - {row[key] === true ? '✅' : row[key] === false ? '❌' : row[key] === 'Module Required' ? 'ℹ️' : ''} |
112 | | - {/if} |
113 | | - </td> |
114 | 86 | {/each} |
115 | 87 | </tr> |
116 | | - {/each} |
117 | | - </tbody> |
118 | | - </table> |
| 88 | + </thead> |
| 89 | + <tbody> |
| 90 | + {#each compatibilityData as row, index} |
| 91 | + <tr class="group even:bg-neutral-800 hover:bg-neutral-700"> |
| 92 | + <td |
| 93 | + class="sticky left-0 z-10 px-4 py-3 text-center text-base text-white {index % 2 === 0 |
| 94 | + ? 'bg-neutral-900' |
| 95 | + : 'bg-neutral-800'} group-hover:bg-neutral-700">{row.device}</td |
| 96 | + > |
| 97 | + {#each features as key} |
| 98 | + <td |
| 99 | + title={typeof row[key] === 'string' ? row[key] : ''} |
| 100 | + class={key === 'Screen' || key === 'ESP' || key === 'Battery' || key === 'Flash' || key === 'PSRAM' ? 'detailed hidden' : ''} |
| 101 | + > |
| 102 | + {#if (key === 'Screen' || key === 'ESP' || key === 'Battery' || key === 'Flash' || key === 'PSRAM') && typeof row[key] === 'string'} |
| 103 | + {row[key]} |
| 104 | + {:else if key === 'NFC' && typeof row[key] === 'string' && row[key] !== 'Module Required'} |
| 105 | + ✅ |
| 106 | + {:else if key === 'Mic'} |
| 107 | + {typeof row[key] === 'string' ? '✅' : '❌'} |
| 108 | + {#if typeof row[key] === 'string'}<span class="detailed hidden">{row[key]}</span>{/if} |
| 109 | + {:else if key === 'Audio'} |
| 110 | + {row[key] === 'Tone' ? '🔈' : typeof row[key] === 'string' ? '🔊' : '❌'} |
| 111 | + {#if typeof row[key] === 'string'}<span class="detailed hidden">{row[key] !== 'Tone' ? 'Full - ' : ''}{row[key]}</span>{/if} |
| 112 | + {:else} |
| 113 | + {row[key] === true ? '✅' : row[key] === false ? '❌' : row[key] === 'Module Required' ? 'ℹ️' : ''} |
| 114 | + {/if} |
| 115 | + </td> |
| 116 | + {/each} |
| 117 | + </tr> |
| 118 | + {/each} |
| 119 | + </tbody> |
| 120 | + </table> |
| 121 | + </div> |
| 122 | + {#if showGradient} |
| 123 | + <div class="scroll-gradient" transition:fade={{ duration: 300 }}></div> |
| 124 | + {/if} |
119 | 125 | </div> |
120 | | - {#if showGradient} |
121 | | - <div class="scroll-gradient" transition:fade={{ duration: 300 }}></div> |
122 | | - {/if} |
123 | | - </div> |
124 | 126 | <br /> |
125 | 127 | <h2 class="text-lg"> |
126 | 128 | For <strong>Wiring Diagrams</strong> check the |
|
0 commit comments