Build success
This commit is contained in:
@ -212,7 +212,14 @@ else
|
||||
fi`
|
||||
};
|
||||
|
||||
return samples[codeSample] || samples.javascript;
|
||||
type SampleLanguage = keyof typeof samples;
|
||||
|
||||
// Type guard to check if codeSample is a valid key of samples
|
||||
const isValidSample = (sample: string): sample is SampleLanguage => {
|
||||
return sample in samples;
|
||||
};
|
||||
|
||||
return isValidSample(codeSample) ? samples[codeSample] : samples.javascript;
|
||||
};
|
||||
|
||||
const handleDownload = (e: React.MouseEvent) => {
|
||||
@ -289,7 +296,7 @@ fi`
|
||||
}}
|
||||
drag="x"
|
||||
dragConstraints={{ left: -50, right: 50 }}
|
||||
onDragEnd={(e, { offset, velocity }) => {
|
||||
onDragEnd={(e, { offset }) => {
|
||||
if (offset.x > 50) handleLike();
|
||||
else if (offset.x < -50) handleDislike();
|
||||
}}
|
||||
|
@ -24,7 +24,7 @@ const HelpDialog: React.FC<HelpDialogProps> = ({ isOpen, onClose, isDarkMode })
|
||||
|
||||
<h3 className="text-xl font-semibold">How it works:</h3>
|
||||
<ol className="list-decimal list-inside space-y-2">
|
||||
<li>You'll be presented with color schemes one at a time.</li>
|
||||
<li>You'll be presented with color schemes one at a time.</li>
|
||||
<li>Swipe right or click the heart icon to like a scheme.</li>
|
||||
<li>Swipe left or click the cross icon to dislike a scheme.</li>
|
||||
<li>The app learns from your preferences and generates new schemes based on what you like.</li>
|
||||
@ -39,7 +39,7 @@ const HelpDialog: React.FC<HelpDialogProps> = ({ isOpen, onClose, isDarkMode })
|
||||
</ul>
|
||||
|
||||
<p>The more you interact with TerminalTinder, the better it becomes at suggesting color schemes. All information is local, so refreshing the page refreshes learning.</p>
|
||||
<p>Made with ❤️ by <a href="https://dws.rip" target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:text-blue-600">DWS</a> - It's your internet, take it back.</p>
|
||||
<p>It's your internet, take it back.</p>
|
||||
<hr className="my-4 border-t border-gray-200 w-full" />
|
||||
<p>All credit for any non generated color schemes goes to their original creators. Color schemes are sourced from <a href="https://github.com/Mayccoll/Gogh" target="_blank" rel="noopener noreferrer" className="text-blue-500 hover:text-blue-600">Gogh</a>.</p>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { ColorScheme } from '../utils/colorSchemes';
|
||||
import { generateYAML, generateJSON, generateXResources, generateTOML } from '../utils/exportFormats';
|
||||
import Image from 'next/image';
|
||||
@ -13,8 +13,6 @@ interface HistoryPopupProps {
|
||||
}
|
||||
|
||||
const HistoryPopup: React.FC<HistoryPopupProps> = ({ likedSchemes, dislikedSchemes, onClose, isDarkMode, outputFormat }) => {
|
||||
const [copiedColor, setCopiedColor] = useState<string | null>(null);
|
||||
|
||||
const handleDownload = (scheme: ColorScheme) => {
|
||||
let content: string;
|
||||
let fileExtension: string;
|
||||
|
@ -1,6 +1,9 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Image from 'next/image';
|
||||
|
||||
// Import the CodeSample type
|
||||
import { CodeSample } from '../utils/types';
|
||||
|
||||
interface SettingsProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
@ -8,8 +11,8 @@ interface SettingsProps {
|
||||
onToggleDarkMode: () => void;
|
||||
outputFormat: string;
|
||||
setOutputFormat: (format: string) => void;
|
||||
codeSample: string;
|
||||
setCodeSample: (sample: string) => void;
|
||||
codeSample: CodeSample;
|
||||
setCodeSample: (sample: CodeSample) => void;
|
||||
saveSettings: boolean;
|
||||
setSaveSettings: (save: boolean) => void;
|
||||
}
|
||||
@ -91,7 +94,7 @@ const Settings: React.FC<SettingsProps> = ({
|
||||
<label className="block mb-2">Code Sample</label>
|
||||
<select
|
||||
value={codeSample}
|
||||
onChange={(e) => setCodeSample(e.target.value)}
|
||||
onChange={(e) => setCodeSample(e.target.value as CodeSample)}
|
||||
className="w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"
|
||||
>
|
||||
<option value="c">C</option>
|
||||
|
Reference in New Issue
Block a user