mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 22:39:36 +08:00
fix: hide elements when isInSpecialView is true
This commit is contained in:
parent
de674ad550
commit
6bab1a5ad8
1
src/renderer/src/assets/images/lang/bash.svg
Normal file
1
src/renderer/src/assets/images/lang/bash.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="#293138" d="M112.205 26.129 71.8 2.142A15.326 15.326 0 0 0 64.005 0c-2.688 0-5.386.717-7.796 2.152L15.795 26.14C10.976 28.999 8 34.289 8 40.018v47.975c0 5.729 2.967 11.019 7.796 13.878L56.2 125.858A15.193 15.193 0 0 0 63.995 128a15.32 15.32 0 0 0 7.796-2.142l40.414-23.987c4.819-2.86 7.796-8.16 7.796-13.878V40.007c0-5.718-2.967-11.019-7.796-13.878zm-31.29 74.907.063 3.448c0 .418-.267.889-.588 1.06l-2.046 1.178c-.321.16-.6-.032-.6-.45l-.032-3.394c-1.745.728-3.523.9-4.647.45-.214-.086-.31-.397-.225-.76l.739-3.117c.064-.246.193-.493.364-.643a.726.726 0 0 1 .193-.139c.117-.064.235-.075.332-.032 1.22.407 2.773.214 4.272-.535 1.907-.964 3.18-2.913 3.16-4.84-.022-1.757-.964-2.474-3.267-2.496-2.934.01-5.675-.567-5.718-4.894-.032-3.555 1.81-7.26 4.744-9.595l-.032-3.48c0-.428.257-.9.589-1.07l1.98-1.264c.322-.161.6.042.6.46l.033 3.48c1.456-.578 2.72-.738 3.865-.47.247.063.364.406.257.802l-.77 3.084a1.372 1.372 0 0 1-.354.622.825.825 0 0 1-.203.15c-.108.053-.204.064-.3.053-.525-.118-1.767-.385-3.727.6-2.056 1.038-2.773 2.827-2.763 4.155.022 1.585.825 2.066 3.63 2.11 3.738.063 5.344 1.691 5.387 5.45.053 3.684-1.917 7.657-4.937 10.077zm28.206-64.787L70.89 59.86c-4.765 2.784-8.278 5.911-8.288 11.662v47.107c0 3.437 1.392 5.665 3.523 6.318a12.81 12.81 0 0 1-2.12.204c-2.239 0-4.445-.61-6.383-1.757L17.219 99.408c-3.951-2.345-6.403-6.725-6.403-11.426V40.007c0-4.7 2.452-9.08 6.403-11.426L57.634 4.594a12.555 12.555 0 0 1 6.382-1.756c2.238 0 4.444.61 6.382 1.756l40.415 23.987c3.33 1.981 5.579 5.397 6.21 9.242-1.36-2.86-4.38-3.63-7.902-1.574z"/><path fill="#4fa847" d="m101.614 92.619-10.066 6.018c-.268.16-.46.332-.46.653v2.635c0 .32.214.46.481.3l10.216-6.212c.268-.16.31-.45.31-.77v-2.324c0-.322-.213-.45-.481-.3z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="#a9bacd" d="M125 50c-4-32-24-50-62-50C29 0 3 24 3 64c0 39 24 64 64 64 32 0 55-19 58-50H87c-2 11-8 20-20 20-21 0-24-16-24-33 0-23 8-35 22-35 13 0 20 7 22 20z" /></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="48" height="48" viewBox="0 0 48 48" style=" fill:#000000;"><g id="surface1"><path style=" fill-rule:evenodd;fill:#283593;" d="M 22.902344 3.285156 C 23.582031 2.90625 24.417969 2.90625 25.097656 3.285156 C 28.449219 5.167969 38.546875 10.835938 41.902344 12.71875 C 42.582031 13.101563 43 13.804688 43 14.566406 C 43 18.332031 43 29.667969 43 33.433594 C 43 34.195313 42.582031 34.898438 41.902344 35.28125 C 38.546875 37.164063 28.453125 42.832031 25.097656 44.714844 C 24.417969 45.09375 23.582031 45.09375 22.902344 44.714844 C 19.546875 42.832031 9.453125 37.164063 6.097656 35.28125 C 5.417969 34.898438 5 34.195313 5 33.433594 C 5 29.667969 5 18.332031 5 14.566406 C 5 13.804688 5.417969 13.101563 6.097656 12.71875 C 9.449219 10.835938 19.550781 5.167969 22.902344 3.285156 Z "/><path style=" fill-rule:evenodd;fill:#5C6BC0;" d="M 5.304688 34.402344 C 5.039063 34.046875 5 33.710938 5 33.253906 C 5 29.511719 5 18.242188 5 14.496094 C 5 13.738281 5.417969 13.039063 6.09375 12.660156 C 9.4375 10.789063 19.5 5.152344 22.84375 3.28125 C 23.519531 2.902344 24.4375 2.910156 25.113281 3.289063 C 28.457031 5.160156 38.484375 10.746094 41.828125 12.617188 C 42.097656 12.769531 42.304688 12.953125 42.488281 13.195313 Z "/><path style=" fill-rule:evenodd;fill:#FFFFFF;" d="M 24 10 C 31.726563 10 38 16.273438 38 24 C 38 31.726563 31.726563 38 24 38 C 16.273438 38 10 31.726563 10 24 C 10 16.273438 16.273438 10 24 10 Z M 24 17 C 27.863281 17 31 20.136719 31 24 C 31 27.863281 27.863281 31 24 31 C 20.136719 31 17 27.863281 17 24 C 17 20.136719 20.136719 17 24 17 Z "/><path style=" fill-rule:evenodd;fill:#3949AB;" d="M 42.484375 13.203125 C 43 13.6875 42.992188 14.414063 42.992188 14.988281 C 42.992188 18.785156 42.960938 29.578125 43 33.371094 C 43.003906 33.769531 42.871094 34.1875 42.675781 34.5 L 23.59375 24 Z "/></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 1.9 KiB |
1
src/renderer/src/assets/images/lang/perl.svg
Normal file
1
src/renderer/src/assets/images/lang/perl.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128"><path d="M121.172 62.878c0-34.048-26.473-61.648-59.135-61.648C29.379 1.23 2.9 28.83 2.9 62.878s26.478 61.651 59.136 61.651c32.662 0 59.135-27.603 59.135-61.651z" fill="#fff"/><path d="M53.34 127.516c-13.91-2.461-25.842-8.812-35.703-19.006C9.25 99.842 3.477 88.928.853 76.763c-1.137-5.256-1.137-20.287 0-25.54C2.629 43 6.075 34.835 10.776 27.714 13.89 23 23.004 13.888 27.716 10.773c7.123-4.7 15.293-8.15 23.514-9.921 5.253-1.137 20.286-1.137 25.543 0C89.58 3.617 100.225 9.4 109.41 18.585c9.187 9.186 14.97 19.828 17.739 32.639 1.133 5.252 1.133 20.283 0 25.54-2.769 12.806-8.552 23.448-17.739 32.634-9.038 9.041-19.55 14.812-32.147 17.65-4.467 1.009-19.238 1.297-23.923.468zm11.567-12.772c0-4.194-.062-4.497-.907-4.497-.838 0-.904.288-.869 3.897.043 4.264.343 5.572 1.211 5.284.401-.132.565-1.491.565-4.684zm-6.757 1.445c1.192-1.196 1.542-1.92 1.542-3.209 0-1.316-.16-1.635-.763-1.519-.417.078-.919.76-1.114 1.507-.194.748-1 1.904-1.783 2.57-1.418 1.196-1.472 2.192-.125 2.192.386 0 1.394-.697 2.243-1.541zm14.943 1.047c.167-.269-.339-1.036-1.122-1.698-.786-.666-1.589-1.822-1.783-2.57-.199-.747-.701-1.429-1.118-1.507-.6-.116-.76.203-.76 1.519 0 2.609 3.743 5.942 4.783 4.256zm-20.66-8.146c0-.261-.634-.822-1.41-1.246-5.054-2.769-10.985-7.176-14.28-10.61-6.433-6.71-9.33-13.388-9.4-21.678-.048-5.54.665-8.43 3.364-13.605 2.609-5.004 5.631-8.78 13.95-17.421 9.287-9.653 11.425-12.2 13.038-15.533 1.148-2.367 1.3-3.231 1.46-8.235.199-6.215-.18-10.506-.927-10.506-.339 0-.401 1.612-.21 5.234.623 11.592-1.53 15.19-14.892 24.881-9.202 6.674-13.424 10.3-16.613 14.264-4.518 5.61-6.52 10.466-7.018 17.05-1.207 15.868 8.848 29.629 26.59 36.385 3.914 1.487 6.348 1.881 6.348 1.02zm30.7-1.285c6.098-2.543 10.736-5.615 15.11-10.007 6.667-6.701 9.439-12.967 9.856-22.242.362-8.134-1.402-13.515-6.437-19.61-3.45-4.173-7.162-7.16-17.174-13.81-13.47-8.953-16.633-12.516-16.633-18.746 0-1.658.3-4.006.662-5.217.623-2.068.608-3.493-.02-1.862-.591 1.546-1.947.837-2.675-1.41l-.7-2.152.264 2.04c.942 7.242 1.06 10.276.642 16.615-.564 8.57-1.616 14.427-4.51 25.076-2.87 10.572-3.387 14.404-3.029 22.476.3 6.825 1.254 11.93 3.474 18.593 2.06 6.183 2.445 6.654 6.235 7.624 2.083.533 4.058 1.433 5.627 2.566 1.476 1.067 2.952 1.76 3.781 1.775.748.012 3.237-.755 5.526-1.709zm-1.371-3.076c-.565-.565-.3-1.048 1.912-3.493 6.97-7.694 10.094-15.641 10.183-25.906.063-6.993-1.483-11.627-6.2-18.593-2.13-3.15-9.634-11.008-13.263-13.893-2.66-2.114-5.398-5.72-5.885-7.76-.494-2.068.892-1.523 2.496.98.787 1.227 2.493 3.03 3.79 4.004 1.296.977 5.132 3.835 8.524 6.355 11.664 8.671 16.859 16.066 18.023 25.672.678 5.556-.397 11.3-3.107 16.634-2.812 5.525-7.937 11.545-12.326 14.477-2.703 1.803-3.556 2.115-4.147 1.523zm-22.837.584c.133-.343-1.036-2.535-2.593-4.875-4.128-6.191-5.924-9.606-7.598-14.454-1.414-4.085-1.492-4.641-1.504-10.883-.015-9.431 1.005-12.422 8.49-24.85 7.057-11.718 8.015-16.258 7.22-34.286-.288-6.46-.611-11.838-.72-11.95-.744-.744-.904 1.172-.627 7.67.545 12.94-.292 20.147-3.018 26.062-1.858 4.026-3.938 7.075-9.53 14.002-7.788 9.637-9.985 14.75-9.946 23.126.031 5.743.806 9.275 3.127 14.185 2.512 5.32 7.135 10.689 12.93 15.011 2.667 1.994 3.391 2.231 3.77 1.242z" fill="#212178"/></svg>
|
||||
|
After Width: | Height: | Size: 3.2 KiB |
@ -286,8 +286,14 @@ export const CodeBlockView: React.FC<Props> = memo(({ children, language, onSave
|
||||
const logo = getLangLogo(language)
|
||||
return (
|
||||
<CodeHeader $isInSpecialView={isInSpecialView}>
|
||||
{logo ? <img src={logo} alt={language} /> : ''}
|
||||
<span style={{ marginTop: '3px' }}>{language}</span>
|
||||
{isInSpecialView ? (
|
||||
''
|
||||
) : (
|
||||
<>
|
||||
{logo && <img src={logo} alt={language} />}
|
||||
<span style={{ marginTop: '2px' }}>{language}</span>
|
||||
</>
|
||||
)}
|
||||
</CodeHeader>
|
||||
)
|
||||
}, [isInSpecialView, language])
|
||||
@ -356,7 +362,7 @@ const CodeHeader = styled.div<{ $isInSpecialView?: boolean }>`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: var(--color-text);
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
font-weight: bold;
|
||||
padding: 0 10px;
|
||||
@ -367,9 +373,9 @@ const CodeHeader = styled.div<{ $isInSpecialView?: boolean }>`
|
||||
background-color: ${(props) => (props.$isInSpecialView ? 'transparent' : 'var(--color-background-mute)')};
|
||||
|
||||
img {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-right: 8px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 6px;
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
import BashIcon from '@renderer/assets/images/lang/bash.svg'
|
||||
import CIcon from '@renderer/assets/images/lang/c.svg'
|
||||
import CMakeIcon from '@renderer/assets/images/lang/cmake.svg'
|
||||
import CppIcon from '@renderer/assets/images/lang/cplusplus.svg'
|
||||
@ -31,6 +32,7 @@ import JavaIcon from '@renderer/assets/images/lang/java.svg'
|
||||
import JavaScriptIcon from '@renderer/assets/images/lang/javascript.svg'
|
||||
import JsonIcon from '@renderer/assets/images/lang/json.svg'
|
||||
import LuaIcon from '@renderer/assets/images/lang/lua.svg'
|
||||
import PerlIcon from '@renderer/assets/images/lang/perl.svg'
|
||||
import PhpIcon from '@renderer/assets/images/lang/php.svg'
|
||||
import PythonIcon from '@renderer/assets/images/lang/python.svg'
|
||||
import RubyIcon from '@renderer/assets/images/lang/ruby.svg'
|
||||
@ -40,37 +42,39 @@ import VBIcon from '@renderer/assets/images/lang/vb.svg'
|
||||
import XMLIcon from '@renderer/assets/images/lang/xml.svg'
|
||||
import YamlIcon from '@renderer/assets/images/lang/yaml.svg'
|
||||
export function getLangLogo(lang: string) {
|
||||
const isLight = true
|
||||
|
||||
if (!lang) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const logoMap = {
|
||||
TS: isLight ? TypeScriptIcon : TypeScriptIcon,
|
||||
TypeScript: isLight ? TypeScriptIcon : TypeScriptIcon,
|
||||
JS: isLight ? JavaScriptIcon : JavaScriptIcon,
|
||||
JavaScript: isLight ? JavaScriptIcon : JavaScriptIcon,
|
||||
Python: isLight ? PythonIcon : PythonIcon,
|
||||
PY: isLight ? PythonIcon : PythonIcon,
|
||||
Java: isLight ? JavaIcon : JavaIcon,
|
||||
CPP: isLight ? CppIcon : CppIcon,
|
||||
CMake: isLight ? CMakeIcon : CMakeIcon,
|
||||
'^c$': isLight ? CIcon : CIcon,
|
||||
csharp: isLight ? CSharpIcon : CSharpIcon,
|
||||
Go: isLight ? GoIcon : GoIcon,
|
||||
Json: isLight ? JsonIcon : JsonIcon,
|
||||
Rust: isLight ? RustIcon : RustIcon,
|
||||
Yaml: isLight ? YamlIcon : YamlIcon,
|
||||
Php: isLight ? PhpIcon : PhpIcon,
|
||||
Ruby: isLight ? RubyIcon : RubyIcon,
|
||||
Lua: isLight ? LuaIcon : LuaIcon,
|
||||
CSS: isLight ? CSS3Icon : CSS3Icon,
|
||||
CSS3: isLight ? CSS3Icon : CSS3Icon,
|
||||
XML: isLight ? XMLIcon : XMLIcon,
|
||||
vb: isLight ? VBIcon : VBIcon,
|
||||
visualbasic: isLight ? VBIcon : VBIcon,
|
||||
HTML: isLight ? XMLIcon : XMLIcon
|
||||
bash: BashIcon,
|
||||
cpp: CppIcon,
|
||||
cmake: CMakeIcon,
|
||||
css: CSS3Icon,
|
||||
css3: CSS3Icon,
|
||||
'^c$': CIcon,
|
||||
'^cs$': CSharpIcon,
|
||||
csharp: CSharpIcon,
|
||||
go: GoIcon,
|
||||
lua: LuaIcon,
|
||||
js: JavaScriptIcon,
|
||||
javascript: JavaScriptIcon,
|
||||
java: JavaIcon,
|
||||
json: JsonIcon,
|
||||
python: PythonIcon,
|
||||
py: PythonIcon,
|
||||
perl: PerlIcon,
|
||||
php: PhpIcon,
|
||||
rs: RustIcon,
|
||||
rust: RustIcon,
|
||||
ts: TypeScriptIcon,
|
||||
typescript: TypeScriptIcon,
|
||||
yml: YamlIcon,
|
||||
yaml: YamlIcon,
|
||||
ruby: RubyIcon,
|
||||
vb: VBIcon,
|
||||
visualbasic: VBIcon,
|
||||
xml: XMLIcon
|
||||
}
|
||||
|
||||
for (const key in logoMap) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user