2323 width : 100% ;
2424 max-width : 500px ;
2525 margin-bottom : 2rem ;
26- display : flex;
27- flex-direction : column;
28- align-items : center;
29- justify-content : center;
30- }
31- input [type = "text" ] {
32- width : 100% ;
33- padding : 0.5rem ;
34- margin-bottom : 1rem ;
35- background-color : # 1e1e1e ;
36- color : # ffffff ;
37- border : 1px solid # 333 ;
38- border-radius : 5px ;
3926 }
40- .file-upload {
41- display : flex;
42- flex-direction : column;
43- gap : 1rem ;
44- margin-bottom : 1rem ;
45- padding : 1rem ;
46- border : 2px dashed # 333 ;
27+ .unified-input {
28+ padding : 1.5rem ;
29+ border : 2px solid # 333 ;
4730 border-radius : 10px ;
4831 background-color : # 1a1a1a ;
4932 transition : all 0.3s ease;
5033 }
51- .file-upload .compact {
52- padding : 0.5rem ;
53- gap : 0.5rem ;
34+ .unified-input .compact {
35+ padding : 1rem ;
5436 }
55- .upload-label {
37+ .input-header {
5638 font-size : 1.1rem ;
5739 font-weight : bold;
5840 color : # ff4081 ;
59- transition : font-size 0.3s ease;
41+ margin-bottom : 1rem ;
42+ transition : all 0.3s ease;
6043 }
61- .upload-label .compact {
44+ .input-header .compact {
6245 font-size : 0.9rem ;
46+ margin-bottom : 0.5rem ;
6347 }
64- input [type = "file" ] {
65- padding : 0.5rem ;
66- background-color : # 2a2a2a ;
48+ .input-controls {
49+ display : flex;
50+ gap : 1rem ;
51+ margin-bottom : 1rem ;
52+ align-items : stretch;
53+ }
54+ input [type = "text" ] {
55+ flex : 1 ;
56+ padding : 0.75rem ;
57+ background-color : # 1e1e1e ;
6758 color : # ffffff ;
68- border : 1px solid # 555 ;
59+ border : 1px solid # 333 ;
6960 border-radius : 5px ;
61+ }
62+ .file-input-wrapper {
63+ position : relative;
64+ display : flex;
65+ align-items : center;
66+ }
67+ input [type = "file" ] {
68+ position : absolute;
69+ opacity : 0 ;
70+ width : 100% ;
71+ height : 100% ;
7072 cursor : pointer;
7173 }
72- input [ type = " file" ]:: -webkit-file-upload-button {
74+ . file-input-label {
7375 background-color : # ff4081 ;
7476 color : white;
75- border : none;
76- padding : 0.5rem 1rem ;
77- border-radius : 3px ;
77+ padding : 0.75rem 1.5rem ;
78+ border-radius : 5px ;
7879 cursor : pointer;
79- margin-right : 1rem ;
80+ font-size : 0.9rem ;
81+ white-space : nowrap;
82+ transition : background-color 0.2s ;
83+ border : none;
8084 }
81- input [ type = " file" ]:: -webkit-file-upload-button : hover {
85+ . file-input-label : hover {
8286 background-color : # e91e63 ;
8387 }
88+ .file-input-label .file-selected {
89+ background-color : # 4caf50 ;
90+ }
91+ .file-input-label .file-selected : hover {
92+ background-color : # 45a049 ;
93+ }
8494 .file-info {
85- font-size : 0.9 rem ;
95+ font-size : 0.85 rem ;
8696 color : # ccc ;
87- margin-top : 0.5rem ;
8897 transition : all 0.3s ease;
8998 }
9099 .file-info .hidden {
179188< h1 > BeJUG Raffle</ h1 >
180189
181190< div class ="input-section ">
182- < input type ="text " id ="nameInput " placeholder ="Type a name and press Enter " aria-label ="Add participant name " />
183-
184- < div class ="file-upload " id ="fileUploadSection ">
185- < div class ="upload-label " id ="uploadLabel "> Or upload CSV file with participants:</ div >
186- < input type ="file " id ="csvFile " accept =".csv " aria-label ="Upload CSV file " />
187- < div class ="file-info " id ="fileInfo "> Expected CSV format with "Name" column (and other optional columns like Title, Email, etc.)</ div >
191+ < div class ="unified-input " id ="unifiedInputSection ">
192+ < div class ="input-header " id ="inputHeader "> Add participants manually or upload CSV file:</ div >
193+ < div class ="input-controls ">
194+ < input type ="text " id ="nameInput " placeholder ="Type a name and press Enter " aria-label ="Add participant name " />
195+ < div class ="file-input-wrapper ">
196+ < input type ="file " id ="csvFile " accept =".csv " aria-label ="Upload CSV file " />
197+ < span class ="file-input-label "> Choose CSV</ span >
198+ </ div >
199+ </ div >
200+ < div class ="file-info " id ="fileInfo "> CSV format: requires "Name" column (other columns like Title, Email, etc. are ignored)</ div >
188201 < div id ="fileMessage "> </ div >
189202 </ div >
190203</ div >
@@ -209,9 +222,10 @@ <h1>BeJUG Raffle</h1>
209222
210223 const nameInput = document . getElementById ( "nameInput" ) ;
211224 const csvFile = document . getElementById ( "csvFile" ) ;
212- const fileUploadSection = document . getElementById ( "fileUploadSection " ) ;
213- const uploadLabel = document . getElementById ( "uploadLabel " ) ;
225+ const unifiedInputSection = document . getElementById ( "unifiedInputSection " ) ;
226+ const inputHeader = document . getElementById ( "inputHeader " ) ;
214227 const fileInfo = document . getElementById ( "fileInfo" ) ;
228+ const fileInputLabel = document . querySelector ( ".file-input-label" ) ;
215229 const participantsList = document . getElementById ( "participantsList" ) ;
216230 const participantsCount = document . getElementById ( "participantsCount" ) ;
217231 const drawButton = document . getElementById ( "drawButton" ) ;
@@ -233,8 +247,10 @@ <h1>BeJUG Raffle</h1>
233247 csvFile . addEventListener ( "change" , function ( e ) {
234248 const file = e . target . files [ 0 ] ;
235249 if ( file && file . type === "text/csv" ) {
236- // Make upload section compact
237- makeUploadSectionCompact ( ) ;
250+ // Make input section compact and update button
251+ makeInputSectionCompact ( ) ;
252+ fileInputLabel . textContent = "✓ CSV Loaded" ;
253+ fileInputLabel . classList . add ( 'file-selected' ) ;
238254
239255 const reader = new FileReader ( ) ;
240256 reader . onload = function ( event ) {
@@ -325,18 +341,20 @@ <h1>BeJUG Raffle</h1>
325341 return result ;
326342 }
327343
328- function makeUploadSectionCompact ( ) {
329- fileUploadSection . classList . add ( 'compact' ) ;
330- uploadLabel . classList . add ( 'compact' ) ;
344+ function makeInputSectionCompact ( ) {
345+ unifiedInputSection . classList . add ( 'compact' ) ;
346+ inputHeader . classList . add ( 'compact' ) ;
331347 fileInfo . classList . add ( 'hidden' ) ;
332- uploadLabel . textContent = "CSV file selected " ;
348+ inputHeader . textContent = "Add more participants or clear all: " ;
333349 }
334350
335- function makeUploadSectionExpanded ( ) {
336- fileUploadSection . classList . remove ( 'compact' ) ;
337- uploadLabel . classList . remove ( 'compact' ) ;
351+ function makeInputSectionExpanded ( ) {
352+ unifiedInputSection . classList . remove ( 'compact' ) ;
353+ inputHeader . classList . remove ( 'compact' ) ;
338354 fileInfo . classList . remove ( 'hidden' ) ;
339- uploadLabel . textContent = "Or upload CSV file with participants:" ;
355+ inputHeader . textContent = "Add participants manually or upload CSV file:" ;
356+ fileInputLabel . textContent = "Choose CSV" ;
357+ fileInputLabel . classList . remove ( 'file-selected' ) ;
340358 }
341359
342360 function showFileMessage ( message , type ) {
@@ -384,7 +402,7 @@ <h1>BeJUG Raffle</h1>
384402 animationDiv . textContent = "" ;
385403 winnerImage . style . display = "none" ;
386404 csvFile . value = "" ;
387- makeUploadSectionExpanded ( ) ;
405+ makeInputSectionExpanded ( ) ;
388406 showFileMessage ( "All participants cleared." , "success" ) ;
389407 }
390408
0 commit comments