feat: 1:1 Yandex ID account menu, official WordsCard AI replies, VibeResetButton pill, and git.tatar updater

This commit is contained in:
marwy 2026-11-27 13:43:33 +03:00
parent 682e3579ab
commit 6c30a33a9b
28 changed files with 2574 additions and 461 deletions

View file

@ -1,4 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<circle cx="10" cy="6.5" r="3.2" stroke="#ffffff" stroke-width="1.6"/>
<path d="M3.8 16.5C4.5 13.6 7 11.8 10 11.8C13 11.8 15.5 13.6 16.2 16.5" stroke="#ffffff" stroke-width="1.6" stroke-linecap="round"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M17.129 9.227c.386.743.576 1.662.576 2.77 0 1.118-.213 2.046-.624 2.798a4 4 0 0 1-1.65 1.63c-1.239.665-2.707.686-3.629.688a1.2 1.2 0 0 1-1.202-1.2V8.208a1.2 1.2 0 0 1 1.198-1.2h.09c1.012-.003 2.454-.006 3.634.609a3.7 3.7 0 0 1 1.607 1.61m-4.53-.212v6.079c.69-.038 1.351-.144 1.887-.432.344-.185.63-.443.84-.827.214-.391.38-.97.38-1.839 0-.888-.155-1.467-.352-1.847a1.7 1.7 0 0 0-.756-.759c-.529-.275-1.206-.354-1.998-.375"/>
<path fill="white" d="M8.258 7.008a1 1 0 0 1 1 1v8.106a1 1 0 1 1-2 0V8.008a1 1 0 0 1 1-1"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M22.01 11.999C22.01 20.002 20.012 22 12.008 22 4.005 22 2.007 20.002 2.007 11.999S4.005 1.997 12.008 1.997 22.01 3.995 22.01 12m-2 0c0 4.016-.55 5.724-1.414 6.587-.864.864-2.571 1.414-6.588 1.414s-5.724-.55-6.587-1.414c-.864-.863-1.414-2.57-1.414-6.587s.55-5.724 1.414-6.588 2.57-1.414 6.587-1.414 5.724.55 6.588 1.414S20.01 7.983 20.01 12"/>
</svg>

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill="white" d="M1.707 17.704c1.12-1.12 2.853-1.7 5.256-1.707.274-.704.62-1.377.985-1.972A16 16 0 0 0 7 13.997c-2.912 0-5.165.751-6.707 2.293a1 1 0 1 0 1.414 1.414"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M7.001 12.797c-2.63 0-4.501-2.692-4.501-5.83 0-2.97 1.596-4.97 4.501-4.97s4.499 2 4.499 4.97c0 3.138-1.87 5.83-4.499 5.83m0-2c1.307 0 2.499-1.596 2.499-3.83 0-2.009-.84-2.97-2.499-2.97S4.5 4.96 4.5 6.967c0 2.234 1.194 3.83 2.501 3.83"/>
<path fill="white" d="M17 13.5a1 1 0 0 0-1 1V16h-1.5a1 1 0 1 0 0 2H16v1.5a1 1 0 1 0 2 0V18h1.5a1 1 0 1 0 0-2H18v-1.5a1 1 0 0 0-1-1"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M10 17a7 7 0 1 1 14 0 7 7 0 0 1-14 0m7-5a5 5 0 1 0 0 10 5 5 0 0 0 0-10"/>
</svg>

After

Width:  |  Height:  |  Size: 853 B

View file

@ -1,5 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<circle cx="10" cy="10" r="7.2" stroke="#ffffff" stroke-width="1.5"/>
<ellipse cx="10" cy="10" rx="3.4" ry="7.2" stroke="#ffffff" stroke-width="1.5"/>
<path d="M3.2 7.5H16.8M3.2 12.5H16.8" stroke="#ffffff" stroke-width="1.4"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M22 11.998c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10 10 4.477 10 10m-2.02.574A8 8 0 0 1 8 18.928v-.58a1 1 0 0 0-.22-.624L6 15.498v-1.78a1 1 0 0 0-.684-.948l-1.31-.436a8 8 0 0 1 .245-2.336h1.335a1 1 0 0 0 .707-.293l2.074-2.074a1 1 0 0 0 .074-1.332l-.806-1.007A7.96 7.96 0 0 1 12 3.998c1.932 0 3.705.685 5.087 1.826L16.5 6.998h-2.71a.958.958 0 0 0-.493 1.778l1.203.722-1.5 1-.63-.315a1 1 0 0 0-.763-.054l-1.04.347a1 1 0 0 0-.13.054l-1.384.692a1 1 0 0 0-.553.894v1.101a1 1 0 0 0 .757.97l1.243.311 1.165 2.717a1 1 0 0 0 1.161.576l.614-.153a1 1 0 0 0 .719-.695l.802-2.81a1 1 0 0 0 .039-.275v-1.86l1-.5.65.976a1 1 0 0 0 .974.435z"/>
</svg>

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 806 B

Before After
Before After

View file

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<path d="M8.5 3.2H5.2C4.1 3.2 3.2 4.1 3.2 5.2V14.8C3.2 15.9 4.1 16.8 5.2 16.8H8.5" stroke="#ffffff" stroke-width="1.6" stroke-linecap="round"/>
<path d="M12.5 6.5L16.2 10L12.5 13.5M16 10H7.5" stroke="#ffffff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill="white" d="M21.593 10.943c.584.585.584 1.53 0 2.116L18.71 15.95c-.39.39-1.03.39-1.42 0a.996.996 0 0 1 0-1.41 9.6 9.6 0 0 1 1.689-1.345l.387-.242-.207-.206a10 10 0 0 1-2.24.254h-7.92a1 1 0 1 1 0-2h7.922a10 10 0 0 1 2.239.254l.207-.206-.386-.241a9.6 9.6 0 0 1-1.69-1.348.996.996 0 0 1 0-1.41c.39-.39 1.03-.39 1.42 0z"/>
<path fill="white" d="M14 16a1 1 0 0 0-1 1v1.5a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v1.505a1 1 0 1 0 2 0V5.5A2.5 2.5 0 0 0 12.5 3h-7A2.5 2.5 0 0 0 3 5.5v13A2.5 2.5 0 0 0 5.5 21h7a2.5 2.5 0 0 0 2.5-2.5V17a1 1 0 0 0-1-1"/>
</svg>

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 694 B

Before After
Before After

View file

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<defs>
<linearGradient id="g" x1="0" y1="0" x2="24" y2="24" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF5C4D"/>
<stop offset="0.35" stop-color="#EB469F"/>
<stop offset="0.75" stop-color="#8341EF"/>
<stop offset="1" stop-color="#3F68F9"/>
</linearGradient>
</defs>
<path fill-rule="evenodd" clip-rule="evenodd" fill="url(#g)" d="M22 11.99c0 5.523-4.477 10-10 10s-10-4.477-10-10 4.477-10 10-10 10 4.478 10 10m-2 0a8 8 0 1 1-5.524-7.609l-1.83 5.61H7.329l-.652 2h5.319l-1.631 5h2.202l1.63-5zm-.252-2h-4.899l1.532-4.695a8 8 0 0 1 3.367 4.696"/>
</svg>

After

Width:  |  Height:  |  Size: 690 B

View file

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M9.172 9.172a4 4 0 1 1 5.656 5.656 4 4 0 0 1-5.656-5.656m1.414 4.242a2 2 0 1 0 2.828-2.828 2 2 0 0 0-2.828 2.828"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="m20.788 5.276 1.427 2.483v.001a1.4 1.4 0 0 1-.365 1.81l-1.858 1.412.002 2.038 1.854 1.41a1.4 1.4 0 0 1 .365 1.814l-1.425 2.479a1.4 1.4 0 0 1-1.755.593l-2.192-.92-1.72.982-.304 2.398A1.404 1.404 0 0 1 13.427 23h-2.853a1.404 1.404 0 0 1-1.39-1.224l-.308-2.421-1.69-.97-2.22.93a1.4 1.4 0 0 1-1.754-.592l-1.427-2.482a1.4 1.4 0 0 1 .365-1.81l1.86-1.413-.004-2.038-1.855-1.41a1.4 1.4 0 0 1-.364-1.814l1.426-2.479a1.4 1.4 0 0 1 1.756-.593l2.191.92 1.72-.982.303-2.398A1.4 1.4 0 0 1 10.573 1h2.853a1.4 1.4 0 0 1 1.39 1.223l.307 2.422 1.69.97 2.22-.93a1.4 1.4 0 0 1 1.755.591m-2.792 8.739-.007-4.023 2.23-1.694-.9-1.565-2.642 1.109-3.412-1.956L12.898 3h-1.796l-.364 2.864L7.294 7.83 4.682 6.733l-.9 1.565 2.222 1.69.007 4.02-2.229 1.694.9 1.565 2.641-1.109 3.412 1.956.367 2.886h1.796l.364-2.864 3.443-1.966 2.613 1.097.9-1.565z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<path d="M10 3C5.86 3 2.5 5.91 2.5 9.5C2.5 11.15 3.21 12.66 4.38 13.8L3.5 17L6.92 15.6C7.87 15.86 8.91 16 10 16C14.14 16 17.5 13.09 17.5 9.5C17.5 5.91 14.14 3 10 3Z" stroke="#ffffff" stroke-width="1.6" stroke-linejoin="round"/>
<circle cx="7" cy="9.5" r="1" fill="#ffffff"/>
<circle cx="10" cy="9.5" r="1" fill="#ffffff"/>
<circle cx="13" cy="9.5" r="1" fill="#ffffff"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M5.719 2.535a1.41 1.41 0 0 0-2.028 1.266v2.825l-1.392-.287C1.097 6.092.175 7.392.806 8.444L2.94 12 .806 15.556c-.63 1.052.291 2.352 1.493 2.105l1.392-.287V20.2a1.41 1.41 0 0 0 2.028 1.266l16.762-8.2c1.053-.514 1.053-2.016 0-2.53zM5.509 17v2.223a.2.2 0 0 0 .288.18l9.393-4.595-2.19.65zm9.681-7.808L5.797 4.598a.2.2 0 0 0-.288.18V7l7.49 1.542zM2.845 8.308 20.778 12 2.845 15.692l1.78-2.967a1.41 1.41 0 0 0 0-1.45z"/>
</svg>

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 582 B

Before After
Before After

View file

@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<path d="M15.8 12.4A6.8 6.8 0 0 1 7.6 4.2A6.8 6.8 0 1 0 15.8 12.4Z" stroke="#ffffff" stroke-width="1.6" stroke-linejoin="round"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M3.57 17.898c2.437 3.059 7.033 4.626 10.867 3.595 5.282-1.42 8.418-6.857 7.005-12.145-1.026-3.84-4.68-7.041-8.544-7.624a.992.992 0 0 0-1.02 1.45c1.868 3.48 2.02 6.456.526 9.047-1.495 2.592-4.146 3.948-8.09 4.067a.992.992 0 0 0-.745 1.61m15.96-8.036c1.13 4.23-1.38 8.58-5.604 9.717-2.41.647-5.68.004-7.74-1.497 3.438-.551 6.384-2.185 7.932-4.87s1.482-6.049.24-9.306c2.328 1.036 4.527 3.543 5.172 5.956"/>
</svg>

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 571 B

Before After
Before After

View file

@ -1,4 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<circle cx="10" cy="10" r="3.4" stroke="#ffffff" stroke-width="1.6"/>
<path d="M10 2.4V4.2M10 15.8V17.6M2.4 10H4.2M15.8 10H17.6M4.6 4.6L5.9 5.9M14.1 14.1L15.4 15.4M15.4 4.6L14.1 5.9M5.9 14.1L4.6 15.4" stroke="#ffffff" stroke-width="1.6" stroke-linecap="round"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill="white" d="M15.106.409a1 1 0 0 0-1.225.707l-.647 2.415a1 1 0 0 0 1.932.517l.647-2.414a1 1 0 0 0-.707-1.225"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0m11 0a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0"/>
<path fill="white" d="M8.834 19.952a1 1 0 1 1 1.932.517l-.647 2.415a1 1 0 1 1-1.932-.518zm-4.695-4.568a1 1 0 0 1 1 1.732l-2.165 1.25a1 1 0 0 1-1-1.732zM22.392 6a1 1 0 0 0-1.366-.366l-2.165 1.25a1 1 0 0 0 1 1.732l2.165-1.25A1 1 0 0 0 22.392 6M4.048 8.834a1 1 0 1 1-.517 1.932l-2.415-.647a1 1 0 0 1 .518-1.932zm19.543 6.272a1 1 0 0 0-.707-1.225l-2.415-.647a1 1 0 1 0-.517 1.932l2.414.647a1 1 0 0 0 1.225-.707M8.616 4.139a1 1 0 1 1-1.732 1l-1.25-2.165a1 1 0 1 1 1.732-1zM18 22.392a1 1 0 0 0 .366-1.366l-1.25-2.165a1 1 0 1 0-1.732 1l1.25 2.165a1 1 0 0 0 1.366.366"/>
</svg>

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 945 B

Before After
Before After

View file

@ -1,4 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
<rect x="2.5" y="3.5" width="15" height="10" rx="1.8" stroke="#ffffff" stroke-width="1.5"/>
<path d="M7 16.5H13M10 13.5V16.5" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round"/>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
<path fill="white" d="M3 7a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3h-2a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6v3H4a2 2 0 0 1-2-2 1 1 0 0 1 1-1z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="white" d="M14 11.4A2.4 2.4 0 0 1 16.4 9h3.2a2.4 2.4 0 0 1 2.4 2.4v8.2a2.4 2.4 0 0 1-2.4 2.4h-3.2a2.4 2.4 0 0 1-2.4-2.4zm2.4-.4a.4.4 0 0 0-.4.4v8.2c0 .22.18.4.4.4h3.2a.4.4 0 0 0 .4-.4v-8.2a.4.4 0 0 0-.4-.4z"/>
</svg>

Before

Width:  |  Height:  |  Size: 267 B

After

Width:  |  Height:  |  Size: 513 B

Before After
Before After

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
<path fill="white" d="M6.16783 3.3431L11.7163 4.16504C12.2676 4.24667 12.6987 4.68292 12.7727 5.23519L13.562 11.1418C13.6111 11.5093 13.5366 11.8828 13.3497 12.203C12.453 13.7384 11.8269 14.8457 11.4722 15.5249C11.0158 16.3991 10.3839 17.7197 9.57684 19.4865C9.47701 19.7609 9.21617 19.9438 8.92417 19.9438C6.30905 19.9436 6.96124 17.0532 8.07458 13.3113C8.07458 13.3113 6.79592 13.3113 4.23993 13.3113C1.85516 13.3112 1.32413 11.2631 1.8555 9.66875L3.32115 5.35157C3.72418 4.14237 4.89712 3.24539 6.16783 3.3431ZM17.4138 3.33334C17.7818 3.33389 18.0798 3.63263 18.0794 4.00065L18.0681 11.8343C18.0675 12.2021 17.7693 12.5 17.4016 12.5H15.9693C15.6321 12.4999 15.3482 12.248 15.3077 11.9133L14.3596 4.0804C14.3563 4.05383 14.3547 4.02662 14.3547 3.99984C14.3548 3.63174 14.6531 3.33335 15.0212 3.33334H17.4138Z"/>
</svg>

After

Width:  |  Height:  |  Size: 919 B

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
<path fill="white" d="M3.77685 7.44385C4.11397 7.44393 4.39795 7.69589 4.43847 8.0306L5.38655 15.8634C5.38977 15.89 5.39143 15.9173 5.39143 15.944C5.39123 16.312 5.09296 16.6105 4.72492 16.6105H2.33235C1.96417 16.61 1.66613 16.3106 1.66666 15.9424L1.67805 8.10954C1.67857 7.74172 1.97673 7.44385 2.34456 7.44385H3.77685ZM10.8219 0C13.437 0.000299683 12.7848 2.89069 11.6716 6.63248H15.5062C17.8908 6.63269 18.4218 8.68 17.8907 10.2743L16.425 14.5923C16.0219 15.8014 14.8489 16.6984 13.5782 16.6008L8.02977 15.7788C7.47845 15.6972 7.04733 15.2603 6.97346 14.7078L6.18407 8.80208C6.13495 8.43458 6.2095 8.0611 6.39647 7.74088L7.01822 6.66993C7.58917 5.67872 8.00786 4.92844 8.27392 4.41894C8.73041 3.5448 9.36216 2.22423 10.1692 0.457357C10.2691 0.18292 10.5299 0 10.8219 0Z"/>
</svg>

After

Width:  |  Height:  |  Size: 881 B

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="62" height="30" viewBox="0 0 62 30" fill="none">
<circle cx="15" cy="15" r="15" fill="#FC3F1D"/>
<path fill="#FFFFFF" d="M15.4069 16.5495C16.2834 18.4695 16.5756 19.1374 16.5756 21.4434V24.5008H13.4451V19.3461L7.53906 6.50084H10.8051L15.4069 16.5495ZM19.2678 6.50084L15.4382 15.2034H18.6208L22.4608 6.50084H19.2678Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FAFAFF" d="M47 29.9995C59.0033 29.9995 62 27.0028 62 14.9995C62 2.99623 59.0033 -0.000488281 47 -0.000488281C34.9967 -0.000488281 32 2.99623 32 14.9995C32 27.0028 34.9967 29.9995 47 29.9995ZM41.8793 5.99942V23.9994H38.7499V5.99942H41.8793ZM48.9153 5.99942C50.1024 5.99942 51.2031 6.1505 52.2175 6.47424C53.2319 6.7764 54.0952 7.29438 54.829 7.98503C55.5628 8.67568 56.1455 9.60374 56.5556 10.726C56.9873 11.8483 57.1815 13.2512 57.1815 14.9131C57.1815 16.3807 56.9657 17.6757 56.5556 18.8196C56.124 19.9419 55.5412 20.8915 54.7858 21.6685C54.0304 22.4455 53.124 23.0282 52.088 23.4167C51.052 23.8052 49.8865 24.021 48.6563 24.021H44.7067V5.99942H48.9153ZM48.3973 21.5606C49.2391 21.5606 50.016 21.4095 50.7067 21.1289C51.3973 20.8483 51.9801 20.4167 52.4765 19.8771C52.9729 19.316 53.3398 18.6253 53.6204 17.7836C53.8793 16.9419 54.0304 15.9706 54.0304 14.8483C54.0304 13.6397 53.9009 12.6253 53.6419 11.8052C53.3829 10.985 53.016 10.316 52.5412 9.81956C52.0664 9.32316 51.5052 8.95625 50.8362 8.74043C50.1887 8.5246 49.4549 8.41669 48.6563 8.41669H47.8362V21.539H48.3973V21.5606Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="62" height="30" viewBox="0 0 62 30" fill="none">
<circle cx="15" cy="15" r="15" fill="#FC3F1D"/>
<path fill="#FFFFFF" d="M15.4069 16.5495C16.2834 18.4695 16.5756 19.1374 16.5756 21.4434V24.5008H13.4451V19.3461L7.53906 6.50084H10.8051L15.4069 16.5495ZM19.2678 6.50084L15.4382 15.2034H18.6208L22.4608 6.50084H19.2678Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#262633" d="M47 29.9995C59.0033 29.9995 62 27.0028 62 14.9995C62 2.99623 59.0033 -0.000488281 47 -0.000488281C34.9967 -0.000488281 32 2.99623 32 14.9995C32 27.0028 34.9967 29.9995 47 29.9995ZM41.8793 5.99942V23.9994H38.7499V5.99942H41.8793ZM48.9153 5.99942C50.1024 5.99942 51.2031 6.1505 52.2175 6.47424C53.2319 6.7764 54.0952 7.29438 54.829 7.98503C55.5628 8.67568 56.1455 9.60374 56.5556 10.726C56.9873 11.8483 57.1815 13.2512 57.1815 14.9131C57.1815 16.3807 56.9657 17.6757 56.5556 18.8196C56.124 19.9419 55.5412 20.8915 54.7858 21.6685C54.0304 22.4455 53.124 23.0282 52.088 23.4167C51.052 23.8052 49.8865 24.021 48.6563 24.021H44.7067V5.99942H48.9153ZM48.3973 21.5606C49.2391 21.5606 50.016 21.4095 50.7067 21.1289C51.3973 20.8483 51.9801 20.4167 52.4765 19.8771C52.9729 19.316 53.3398 18.6253 53.6204 17.7836C53.8793 16.9419 54.0304 15.9706 54.0304 14.8483C54.0304 13.6397 53.9009 12.6253 53.6419 11.8052C53.3829 10.985 53.016 10.316 52.5412 9.81956C52.0664 9.32316 51.5052 8.95625 50.8362 8.74043C50.1887 8.5246 49.4549 8.41669 48.6563 8.41669H47.8362V21.539H48.3973V21.5606Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="62" height="30" viewBox="0 0 62 30" fill="none">
<circle cx="15" cy="15" r="15" fill="#FC3F1D"/>
<path fill="#FFFFFF" d="M17.2116 8.40037H15.6936C13.0912 8.40037 11.7899 9.70158 11.7899 11.6534C11.7899 13.8221 12.6574 14.9064 14.6092 16.2076L16.1273 17.2919L11.7899 24.0148H8.32007L12.4405 17.9425C10.055 16.2076 8.7538 14.6895 8.7538 11.8703C8.7538 8.40037 11.1393 6.01483 15.6936 6.01483H20.2478V24.0148H17.2116V8.40037Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#FAFAFF" d="M47 29.9995C59.0033 29.9995 62 27.0028 62 14.9995C62 2.99623 59.0033 -0.000488281 47 -0.000488281C34.9967 -0.000488281 32 2.99623 32 14.9995C32 27.0028 34.9967 29.9995 47 29.9995ZM41.8793 5.99942V23.9994H38.7499V5.99942H41.8793ZM48.9153 5.99942C50.1024 5.99942 51.2031 6.1505 52.2175 6.47424C53.2319 6.7764 54.0952 7.29438 54.829 7.98503C55.5628 8.67568 56.1455 9.60374 56.5556 10.726C56.9873 11.8483 57.1815 13.2512 57.1815 14.9131C57.1815 16.3807 56.9657 17.6757 56.5556 18.8196C56.124 19.9419 55.5412 20.8915 54.7858 21.6685C54.0304 22.4455 53.124 23.0282 52.088 23.4167C51.052 23.8052 49.8865 24.021 48.6563 24.021H44.7067V5.99942H48.9153ZM48.3973 21.5606C49.2391 21.5606 50.016 21.4095 50.7067 21.1289C51.3973 20.8483 51.9801 20.4167 52.4765 19.8771C52.9729 19.316 53.3398 18.6253 53.6204 17.7836C53.8793 16.9419 54.0304 15.9706 54.0304 14.8483C54.0304 13.6397 53.9009 12.6253 53.6419 11.8052C53.3829 10.985 53.016 10.316 52.5412 9.81956C52.0664 9.32316 51.5052 8.95625 50.8362 8.74043C50.1887 8.5246 49.4549 8.41669 48.6563 8.41669H47.8362V21.539H48.3973V21.5606Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" width="62" height="30" viewBox="0 0 62 30" fill="none">
<circle cx="15" cy="15" r="15" fill="#FC3F1D"/>
<path fill="#FFFFFF" d="M17.2116 8.40037H15.6936C13.0912 8.40037 11.7899 9.70158 11.7899 11.6534C11.7899 13.8221 12.6574 14.9064 14.6092 16.2076L16.1273 17.2919L11.7899 24.0148H8.32007L12.4405 17.9425C10.055 16.2076 8.7538 14.6895 8.7538 11.8703C8.7538 8.40037 11.1393 6.01483 15.6936 6.01483H20.2478V24.0148H17.2116V8.40037Z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#262633" d="M47 29.9995C59.0033 29.9995 62 27.0028 62 14.9995C62 2.99623 59.0033 -0.000488281 47 -0.000488281C34.9967 -0.000488281 32 2.99623 32 14.9995C32 27.0028 34.9967 29.9995 47 29.9995ZM41.8793 5.99942V23.9994H38.7499V5.99942H41.8793ZM48.9153 5.99942C50.1024 5.99942 51.2031 6.1505 52.2175 6.47424C53.2319 6.7764 54.0952 7.29438 54.829 7.98503C55.5628 8.67568 56.1455 9.60374 56.5556 10.726C56.9873 11.8483 57.1815 13.2512 57.1815 14.9131C57.1815 16.3807 56.9657 17.6757 56.5556 18.8196C56.124 19.9419 55.5412 20.8915 54.7858 21.6685C54.0304 22.4455 53.124 23.0282 52.088 23.4167C51.052 23.8052 49.8865 24.021 48.6563 24.021H44.7067V5.99942H48.9153ZM48.3973 21.5606C49.2391 21.5606 50.016 21.4095 50.7067 21.1289C51.3973 20.8483 51.9801 20.4167 52.4765 19.8771C52.9729 19.316 53.3398 18.6253 53.6204 17.7836C53.8793 16.9419 54.0304 15.9706 54.0304 14.8483C54.0304 13.6397 53.9009 12.6253 53.6419 11.8052C53.3829 10.985 53.016 10.316 52.5412 9.81956C52.0664 9.32316 51.5052 8.95625 50.8362 8.74043C50.1887 8.5246 49.4549 8.41669 48.6563 8.41669H47.8362V21.539H48.3973V21.5606Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -245,12 +245,19 @@ impl YandexApiClient {
.as_str()
.filter(|s| !s.is_empty())
.map(|id| format!("https://avatars.yandex.net/get-yapic/{}/islands-200", id));
let default_email = res["defaultEmail"]
.as_str()
.or_else(|| res["account"]["defaultEmail"].as_str())
.or_else(|| res["email"].as_str())
.filter(|s| !s.is_empty())
.map(String::from);
return Ok(UserAccount {
uid,
login,
display_name,
has_plus,
avatar_uri,
default_email,
});
}
}
@ -269,12 +276,19 @@ impl YandexApiClient {
let avatar_uri = acc["avatarHash"]
.as_str()
.map(|h| format!("https://avatars.yandex.net/get-yapic/{}/islands-200", h));
let default_email = acc["defaultEmail"]
.as_str()
.or_else(|| res["defaultEmail"].as_str())
.or_else(|| acc["email"].as_str())
.filter(|s| !s.is_empty())
.map(String::from);
Ok(UserAccount {
uid,
login,
display_name,
has_plus,
avatar_uri,
default_email,
})
}
@ -2362,6 +2376,234 @@ impl YandexApiClient {
writers,
})
}
// =========================================================================
// 10. OFFICIAL 5.129.0 AI WORDS CARDS (`POST /words/cards`, `/words/big-cards`, `PUT /words/cards/feedback`)
// =========================================================================
pub async fn fetch_words_cards(
&self,
track_ids: &[String],
wave_seeds: Option<&[String]>,
) -> Result<Vec<(String, Option<WordsCard>)>> {
if !self.has_token() || track_ids.is_empty() {
return Ok(Vec::new());
}
let mut body = json!({
"trackIds": track_ids,
"viewedCards": [],
"viewedBigCards": [],
"actionProvider": "alice",
});
if let Some(seeds) = wave_seeds {
if !seeds.is_empty() {
body["waveContext"] = json!({ "seeds": seeds });
}
}
let res = self.post_json("/words/cards", &body, false).await?;
Ok(parse_words_cards_response(&res, track_ids))
}
pub async fn fetch_words_big_card(
&self,
big_card_id: &str,
track_id: &str,
card_id: &str,
) -> Result<Option<WordsBigCard>> {
if !self.has_token() || big_card_id.is_empty() {
return Ok(None);
}
let clean_track_id = track_id.split(':').next().unwrap_or(track_id);
let body = json!({
"bigCardIds": [big_card_id],
"bigCardContexts": [{
"bigCardId": big_card_id,
"trackId": clean_track_id,
"cardId": card_id,
}],
"actionProvider": "alice",
});
let res = self.post_json("/words/big-cards", &body, false).await?;
Ok(parse_words_big_card_response(&res))
}
pub async fn send_words_feedback(&self, card_id: &str, feedback_state: &str) -> Result<()> {
if !self.has_token() || card_id.is_empty() {
return Ok(());
}
let body = json!({
"feedback": [{
"id": card_id,
"feedbackState": feedback_state,
}],
});
let _ = self.put_json("/words/cards/feedback", &body).await?;
Ok(())
}
}
fn parse_words_card_source(v: &Value) -> Option<WordsCardSource> {
let title = v["title"].as_str().map(str::trim).filter(|s| !s.is_empty())?.to_string();
let url = v["url"]
.as_str()
.or_else(|| v["weblink"].as_str())
.or_else(|| v["link"].as_str())
.map(str::trim)
.filter(|s| !s.is_empty())?
.to_string();
let favicon_url = v["faviconUrl"]
.as_str()
.or_else(|| v["favicon_url"].as_str())
.map(str::trim)
.filter(|s| !s.is_empty())
.map(String::from);
Some(WordsCardSource {
title,
url,
favicon_url,
})
}
fn parse_words_card_entry(item: &Value, clean_track_id: &str) -> Option<WordsCard> {
let card_obj = if item.get("card").map_or(false, Value::is_object) {
&item["card"]
} else {
item
};
let id = value_id(&card_obj["id"]).or_else(|| value_id(&item["id"]))?;
let text = card_obj["text"]
.as_str()
.map(str::trim)
.filter(|s| !s.is_empty())?
.to_string();
let tags = card_obj["tags"]
.as_array()
.map(|arr| {
arr.iter()
.filter_map(|t| t.as_str().map(String::from))
.collect()
})
.unwrap_or_default();
let action = card_obj.get("action").and_then(|a| {
let title = a["title"].as_str().map(str::trim).filter(|s| !s.is_empty())?;
let url = a["weblink"]
.as_str()
.or_else(|| a["link"].as_str())
.or_else(|| a["url"].as_str())
.map(str::trim)
.filter(|s| !s.is_empty())?;
Some(WordsCardAction {
title: title.to_string(),
url: url.to_string(),
})
});
let actions = card_obj["actions"]
.as_array()
.map(|arr| arr.iter().filter_map(parse_words_card_source).collect())
.unwrap_or_default();
let big_card_ids = card_obj["bigCardIds"]
.as_array()
.map(|arr| arr.iter().filter_map(value_id).collect())
.unwrap_or_default();
let feedback_state = item["feedbackState"]
.as_str()
.or_else(|| card_obj["feedbackState"].as_str())
.map(str::trim)
.filter(|s| !s.is_empty() && !s.eq_ignore_ascii_case("neutral"))
.map(String::from);
Some(WordsCard {
id,
track_id: clean_track_id.to_string(),
text,
tags,
action,
actions,
big_card_ids,
feedback_state,
})
}
fn parse_words_cards_response(
val: &Value,
requested_ids: &[String],
) -> Vec<(String, Option<WordsCard>)> {
let mut parsed_map: std::collections::HashMap<String, Option<WordsCard>> =
std::collections::HashMap::new();
let entries = val
.as_array()
.or_else(|| val["result"].as_array())
.or_else(|| val["tracks"].as_array());
if let Some(arr) = entries {
for entry in arr {
let Some(raw_id) = value_id(&entry["id"]).or_else(|| value_id(&entry["trackId"]))
else {
continue;
};
let clean_id = raw_id.split(':').next().unwrap_or(&raw_id).to_string();
let mut chosen: Option<WordsCard> = None;
if let Some(cards) = entry["cards"].as_array() {
let mut fallback_first: Option<WordsCard> = None;
for c in cards {
if let Some(wc) = parse_words_card_entry(c, &clean_id) {
if !wc.is_disliked() {
chosen = Some(wc);
break;
}
if fallback_first.is_none() {
fallback_first = Some(wc);
}
}
}
if chosen.is_none() {
chosen = fallback_first;
}
}
parsed_map.insert(clean_id, chosen);
}
}
let mut out = Vec::new();
let mut seen = HashSet::new();
for req in requested_ids {
let clean = req.split(':').next().unwrap_or(req).to_string();
if seen.insert(clean.clone()) {
let card = parsed_map.remove(&clean).flatten();
out.push((clean, card));
}
}
for (id, card) in parsed_map {
if seen.insert(id.clone()) {
out.push((id, card));
}
}
out
}
fn parse_words_big_card_response(val: &Value) -> Option<WordsBigCard> {
let first = val
.as_array()
.and_then(|arr| arr.first())
.or_else(|| val["result"].as_array().and_then(|arr| arr.first()))
.unwrap_or(val);
let obj = if first.get("bigCard").map_or(false, Value::is_object) {
&first["bigCard"]
} else if first.get("card").map_or(false, Value::is_object) {
&first["card"]
} else {
first
};
let id = value_id(&obj["id"]).or_else(|| value_id(&first["id"]))?;
let text = obj["text"]
.as_str()
.map(str::trim)
.filter(|s| !s.is_empty())?
.to_string();
let actions = obj["actions"]
.as_array()
.map(|arr| arr.iter().filter_map(parse_words_card_source).collect())
.unwrap_or_default();
Some(WordsBigCard { id, text, actions })
}
fn parse_writers_field(v: &Value) -> Option<String> {
@ -2710,4 +2952,76 @@ mod tests {
assert_eq!(tr.derived_average_hex.as_deref(), Some("#F56E00"));
assert!(tr.has_lyrics);
}
#[test]
fn test_parse_words_cards_and_big_card() {
let payload = json!([
{
"id": "101:555",
"cards": [
{
"card": {
"id": "card-1",
"text": "Этот трек записали за одну ночь в студии.",
"tags": ["FACT", "HISTORY"],
"action": {
"title": "Подробнее",
"weblink": "https://music.yandex.ru/album/555"
},
"actions": [
{
"title": "Wikipedia",
"url": "https://ru.wikipedia.org/wiki/Test",
"faviconUrl": "https://ru.wikipedia.org/favicon.ico"
}
],
"bigCardIds": ["big-99"]
},
"feedbackState": "like"
}
]
},
{
"id": "102",
"cards": []
}
]);
let requested = vec!["101".to_string(), "102".to_string(), "103".to_string()];
let parsed = parse_words_cards_response(&payload, &requested);
assert_eq!(parsed.len(), 3);
assert_eq!(parsed[0].0, "101");
let card = parsed[0].1.as_ref().expect("track 101 should have card");
assert_eq!(card.id, "card-1");
assert_eq!(card.track_id, "101");
assert!(card.is_fact());
assert!(card.is_liked());
assert!(!card.is_disliked());
assert!(card.has_big_card());
assert_eq!(card.big_card_ids, vec!["big-99"]);
assert_eq!(
card.action.as_ref().map(|a| (a.title.as_str(), a.url.as_str())),
Some(("Подробнее", "https://music.yandex.ru/album/555"))
);
assert_eq!(card.actions.len(), 1);
assert_eq!(card.actions[0].title, "Wikipedia");
assert_eq!(parsed[1], ("102".to_string(), None));
assert_eq!(parsed[2], ("103".to_string(), None));
let big_payload = json!([
{
"id": "big-99",
"text": "Полная история создания трека в деталях.",
"actions": [
{ "title": "Genius", "url": "https://genius.com/test" }
]
}
]);
let big = parse_words_big_card_response(&big_payload).expect("big card should parse");
assert_eq!(big.id, "big-99");
assert_eq!(big.text, "Полная история создания трека в деталях.");
assert_eq!(big.actions.len(), 1);
assert_eq!(big.actions[0].url, "https://genius.com/test");
}
}

View file

@ -8,6 +8,8 @@ pub struct UserAccount {
pub display_name: String,
pub has_plus: bool,
pub avatar_uri: Option<String>,
#[serde(default)]
pub default_email: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -393,3 +395,61 @@ pub struct MetatagDetail {
pub artists: Vec<ArtistSummary>,
pub playlists: Vec<PlaylistSummary>,
}
/// Optional clickable action link attached to an AI WordsCard (`card.action`).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WordsCardAction {
pub title: String,
pub url: String,
}
/// External source citation attached to an AI WordsCard / WordsBigCard (`actions[]`).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WordsCardSource {
pub title: String,
pub url: String,
pub favicon_url: Option<String>,
}
/// Official 5.129.0 AI Track Fact / Reply card returned by `POST /words/cards`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WordsCard {
pub id: String,
pub track_id: String,
pub text: String,
pub tags: Vec<String>,
pub action: Option<WordsCardAction>,
pub actions: Vec<WordsCardSource>,
pub big_card_ids: Vec<String>,
pub feedback_state: Option<String>,
}
impl WordsCard {
pub fn is_fact(&self) -> bool {
self.tags.iter().any(|t| t == "FACT")
}
pub fn is_liked(&self) -> bool {
self.feedback_state
.as_deref()
.map_or(false, |s| s.eq_ignore_ascii_case("like"))
}
pub fn is_disliked(&self) -> bool {
self.feedback_state
.as_deref()
.map_or(false, |s| s.eq_ignore_ascii_case("dislike"))
}
pub fn has_big_card(&self) -> bool {
!self.big_card_ids.is_empty()
}
}
/// Expanded full-screen AI fact/story card returned by `POST /words/big-cards`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WordsBigCard {
pub id: String,
pub text: String,
pub actions: Vec<WordsCardSource>,
}

View file

@ -4,7 +4,7 @@
use crate::config::{Language, ThemeMode};
pub const APP_VERSION: &str = "5.129.0";
pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
/// Lightweight zero-allocation localization helper bound to a `Language`.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -589,6 +589,36 @@ impl I18n {
self.pick("Неизвестный исполнитель", "Unknown artist")
}
// -------------------------------------------------------------------------
// Official 5.129.0 AI WordsCard Strings
// -------------------------------------------------------------------------
pub const fn words_feedback_like(self) -> &'static str {
self.pick("Спасибо за оценку", "Thank you for your rating!")
}
pub const fn words_feedback_dislike(self) -> &'static str {
self.pick(
"Спасибо, что помогаете мне стать лучше",
"Thank you for making me become better!",
)
}
pub const fn words_more_similar(self) -> &'static str {
self.pick("Больше такого", "More similar replies")
}
pub const fn words_not_cool(self) -> &'static str {
self.pick("Мимо", "Not cool")
}
pub const fn words_ai_disclaimer(self) -> &'static str {
self.pick(
"AI может ошибаться, проверяйте важное",
"AI may make mistakes, be sure to double-check important information",
)
}
// -------------------------------------------------------------------------
// Formatted Labels & Official Toasts (§2.7)
// -------------------------------------------------------------------------
@ -838,11 +868,21 @@ impl I18n {
}
}
pub fn toast_latest_version(self) -> String {
self.toast_up_to_date()
}
pub fn toast_update_available(self, newer: &str) -> String {
if self.is_ru() {
format!("Доступно обновление: {} (текущая {})", newer, APP_VERSION)
format!(
"Доступно обновление: {} (текущая {}) — нажмите снова, чтобы открыть",
newer, APP_VERSION
)
} else {
format!("Update available: {} (current {})", newer, APP_VERSION)
format!(
"Update available: {} (current {}) — click again to open",
newer, APP_VERSION
)
}
}

View file

@ -76,12 +76,14 @@ impl AppState {
track.r128_tp,
);
self.fetch_lyrics_async(&track);
self.ensure_words_for_current_track();
return;
}
// Report track start to `POST /plays`
self.send_play_telemetry("start");
self.fetch_lyrics_async(&track);
self.ensure_words_for_current_track();
if self.api.has_token() {
let api = self.api.clone();
@ -618,6 +620,189 @@ impl AppState {
self.start_vibe_by_seeds(default_vibe, vec!["user:onyourwave".to_string()]);
}
// =========================================================================
// 1b. OFFICIAL 5.129.0 AI WORDS CARDS (Facts, Replies, BigCard & Feedback)
// =========================================================================
pub fn current_words_card(&self) -> Option<&WordsCard> {
let tr = self.current_track()?;
let clean_id = tr.id.split(':').next().unwrap_or(&tr.id);
self.words_cards
.get(&tr.id)
.or_else(|| self.words_cards.get(clean_id))
}
pub fn current_words_feedback_message(&self) -> Option<&str> {
let (ref msg, at) = self.words_feedback_message.as_ref()?;
if at.elapsed() < Duration::from_secs(3) {
Some(msg.as_str())
} else {
None
}
}
pub fn clear_words_cache(&mut self) {
self.words_cards.clear();
self.words_loading_tracks.clear();
self.words_empty_tracks.clear();
self.words_big_card = None;
self.words_big_card_loading = false;
self.words_big_card_open = false;
self.words_feedback_message = None;
}
pub fn ensure_words_for_current_track(&mut self) {
if !self.api.has_token() {
return;
}
let Some(curr) = self.current_track() else {
return;
};
let curr_clean = curr.id.split(':').next().unwrap_or(&curr.id).to_string();
if self.words_cards.contains_key(&curr_clean)
|| self.words_loading_tracks.contains(&curr_clean)
|| self.words_empty_tracks.contains(&curr_clean)
{
return;
}
// Batch current track + up to 2 upcoming tracks so skipping on My Vibe feels instant!
let mut req_ids: Vec<String> = Vec::new();
for offset in 0..3 {
if let Some(tr) = self.queue.get(self.queue_index + offset) {
let clean = tr.id.split(':').next().unwrap_or(&tr.id).to_string();
if !clean.is_empty()
&& !self.words_cards.contains_key(&clean)
&& !self.words_loading_tracks.contains(&clean)
&& !self.words_empty_tracks.contains(&clean)
&& !req_ids.contains(&clean)
{
self.words_loading_tracks.insert(clean.clone());
req_ids.push(clean);
}
}
}
if req_ids.is_empty() {
return;
}
let wave_seeds: Option<Vec<String>> = if self.is_vibe_active {
let parsed: Vec<String> = self
.context_key
.strip_prefix("vibe:")
.map(|s| {
s.split(',')
.map(str::trim)
.filter(|p| !p.is_empty())
.map(String::from)
.collect()
})
.unwrap_or_default();
if parsed.is_empty() {
Some(vec!["user:onyourwave".to_string()])
} else {
Some(parsed)
}
} else {
None
};
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
match api
.fetch_words_cards(&req_ids, wave_seeds.as_deref())
.await
{
Ok(entries) => {
let _ = tx.send(ApiEvent::WordsCardsLoaded(entries));
}
Err(e) => {
log::debug!("[words] /words/cards failed: {}", e);
let empty = req_ids.into_iter().map(|id| (id, None)).collect();
let _ = tx.send(ApiEvent::WordsCardsLoaded(empty));
}
}
});
}
pub fn open_words_big_card(&mut self, track_id: String) {
let clean_id = track_id.split(':').next().unwrap_or(&track_id).to_string();
self.words_big_card_open = true;
let maybe_req = self
.words_cards
.get(&track_id)
.or_else(|| self.words_cards.get(&clean_id))
.and_then(|c| c.big_card_ids.first().map(|bid| (bid.clone(), c.id.clone())));
let Some((big_card_id, card_id)) = maybe_req else {
self.words_big_card_loading = false;
return;
};
if self
.words_big_card
.as_ref()
.map_or(false, |bc| bc.id == big_card_id)
{
self.words_big_card_loading = false;
return;
}
self.words_big_card = None;
if !self.api.has_token() {
self.words_big_card_loading = false;
return;
}
self.words_big_card_loading = true;
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
let res = api
.fetch_words_big_card(&big_card_id, &clean_id, &card_id)
.await
.ok()
.flatten();
let _ = tx.send(ApiEvent::WordsBigCardLoaded(res));
});
}
pub fn send_words_feedback(&mut self, track_id: String, card_id: String, state: String) {
let clean_id = track_id.split(':').next().unwrap_or(&track_id).to_string();
let norm_state = if state.eq_ignore_ascii_case("neutral") {
None
} else {
Some(state.clone())
};
let lookup_key = if self.words_cards.contains_key(&track_id) {
&track_id
} else {
&clean_id
};
if let Some(card) = self.words_cards.get_mut(lookup_key) {
card.feedback_state = norm_state;
}
let t = self.i18n();
if state.eq_ignore_ascii_case("dislike") {
self.words_big_card_open = false;
self.words_big_card_loading = false;
self.words_feedback_message =
Some((t.words_feedback_dislike().to_string(), Instant::now()));
} else if state.eq_ignore_ascii_case("like") {
self.words_feedback_message =
Some((t.words_feedback_like().to_string(), Instant::now()));
}
if self.api.has_token() && !card_id.is_empty() {
let api = self.api.clone();
self.runtime.spawn(async move {
let _ = api.send_words_feedback(&card_id, &state).await;
});
}
}
// =========================================================================
// 2. LIKES, DISLIKES & PINS (Playlist, Album, Artist, Liked, Wave)
// =========================================================================
@ -2272,4 +2457,92 @@ mod tests {
assert!(!app.shuffle);
assert_eq!(app.repeat, RepeatMode::Off);
}
#[test]
fn test_words_card_state_feedback_and_big_card() {
let tracks = vec![make_track("w1", "Track One"), make_track("w2", "Track Two")];
let (_rt, mut app) = make_test_state(tracks);
// Simulate WordsCardsLoaded delivering a FACT card for w1 and empty for w2
app.words_loading_tracks.insert("w1".into());
app.words_loading_tracks.insert("w2".into());
let card = WordsCard {
id: "c_1".into(),
track_id: "w1".into(),
text: "Факт о треке".into(),
tags: vec!["FACT".into()],
action: None,
actions: vec![WordsCardSource {
title: "Wiki".into(),
url: "https://wikipedia.org".into(),
favicon_url: None,
}],
big_card_ids: vec!["big_1".into()],
feedback_state: None,
};
let _ = app.tx_api.send(ApiEvent::WordsCardsLoaded(vec![
("w1".into(), Some(card)),
("w2".into(), None),
]));
assert!(app.poll_async_events());
assert!(app.words_loading_tracks.is_empty());
assert!(app.words_empty_tracks.contains("w2"));
let cur = app.current_words_card().expect("w1 card should be active");
assert!(cur.is_fact());
assert!(cur.has_big_card());
assert!(!cur.is_liked());
assert!(!cur.is_disliked());
// Open big card & load content
app.dispatch(AppAction::OpenWordsBigCard {
track_id: "w1".into(),
});
assert!(app.words_big_card_open);
let _ = app.tx_api.send(ApiEvent::WordsBigCardLoaded(Some(WordsBigCard {
id: "big_1".into(),
text: "Полный рассказ о треке".into(),
actions: vec![],
})));
assert!(app.poll_async_events());
assert!(!app.words_big_card_loading);
assert_eq!(
app.words_big_card.as_ref().map(|b| b.id.as_str()),
Some("big_1")
);
// Like feedback sets localized toast message
app.dispatch(AppAction::SendWordsFeedback {
track_id: "w1".into(),
card_id: "c_1".into(),
state: "like".into(),
});
assert!(app.current_words_card().unwrap().is_liked());
assert_eq!(
app.current_words_feedback_message(),
Some("Спасибо за оценку")
);
// Dislike feedback closes big card modal and sets EN message after SetLanguage(En)
app.config.language = crate::config::Language::En;
app.dispatch(AppAction::SendWordsFeedback {
track_id: "w1".into(),
card_id: "c_1".into(),
state: "dislike".into(),
});
assert!(app.current_words_card().unwrap().is_disliked());
assert!(!app.words_big_card_open);
assert_eq!(
app.current_words_feedback_message(),
Some("Thank you for making me become better!")
);
// CloseWordsBigCard & DismissOverlays clear open state
app.words_big_card_open = true;
app.dispatch(AppAction::CloseWordsBigCard);
assert!(!app.words_big_card_open);
app.words_big_card_open = true;
app.dispatch(AppAction::DismissOverlays);
assert!(!app.words_big_card_open);
}
}

View file

@ -1,5 +1,5 @@
use crossbeam_channel::{unbounded, Receiver, Sender};
use std::collections::HashSet;
use std::collections::{HashMap, HashSet};
use std::path::PathBuf;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
@ -344,6 +344,15 @@ pub enum AppAction {
SetEqPopoverOpen(bool),
OpenTrackDetailModal(Track),
CloseTrackDetailModal,
OpenWordsBigCard {
track_id: String,
},
CloseWordsBigCard,
SendWordsFeedback {
track_id: String,
card_id: String,
state: String,
},
DismissOverlays,
// Account, Settings & Lifecycle
@ -409,6 +418,8 @@ pub(crate) enum ApiEvent {
result: Result<ResolvedStream, String>,
},
LyricsLoaded(TrackLyrics),
WordsCardsLoaded(Vec<(String, Option<WordsCard>)>),
WordsBigCardLoaded(Option<WordsBigCard>),
QueueTracksHydrated(Vec<Track>),
OAuthTokenReceived(Result<String, String>),
PlaylistCreated {
@ -435,7 +446,7 @@ pub(crate) enum ApiEvent {
track: Track,
result: Result<PathBuf, String>,
},
UpdateCheckFinished(Result<Option<String>, String>),
UpdateCheckFinished(Result<Option<(String, String)>, String>),
}
// =============================================================================
@ -515,6 +526,15 @@ pub struct AppState {
pub repeat: RepeatMode,
pub current_lyrics: Option<TrackLyrics>,
pub modal_lyrics: Option<TrackLyrics>,
// Official 5.129.0 AI WordsCard state (`POST /words/cards`, `/words/big-cards`, `PUT /words/cards/feedback`)
pub words_cards: HashMap<String, WordsCard>,
pub words_loading_tracks: HashSet<String>,
pub words_empty_tracks: HashSet<String>,
pub words_big_card: Option<WordsBigCard>,
pub words_big_card_loading: bool,
pub words_big_card_open: bool,
pub words_feedback_message: Option<(String, Instant)>,
pub current_hue: f32,
pub target_hue: f32,
pub smooth_sat: f32,
@ -554,6 +574,7 @@ pub struct AppState {
pub clear_cover_cache_requested: bool,
pub cover_cache_capacity_dirty: bool,
pub pending_clipboard_text: Option<String>,
pub available_update: Option<(String, String)>,
pub persist_enabled: bool,
}
@ -650,6 +671,13 @@ impl AppState {
repeat: RepeatMode::Off,
current_lyrics: None,
modal_lyrics: None,
words_cards: HashMap::new(),
words_loading_tracks: HashSet::new(),
words_empty_tracks: HashSet::new(),
words_big_card: None,
words_big_card_loading: false,
words_big_card_open: false,
words_feedback_message: None,
current_hue: 0.12,
target_hue: 0.12,
smooth_sat: 1.0,
@ -683,6 +711,7 @@ impl AppState {
clear_cover_cache_requested: false,
cover_cache_capacity_dirty: false,
pending_clipboard_text: None,
available_update: None,
persist_enabled: true,
};
@ -789,6 +818,13 @@ impl AppState {
repeat: RepeatMode::Off,
current_lyrics: None,
modal_lyrics: None,
words_cards: HashMap::new(),
words_loading_tracks: HashSet::new(),
words_empty_tracks: HashSet::new(),
words_big_card: None,
words_big_card_loading: false,
words_big_card_open: false,
words_feedback_message: None,
current_hue: 0.12,
target_hue: 0.12,
smooth_sat: 1.0,
@ -822,6 +858,7 @@ impl AppState {
clear_cover_cache_requested: false,
cover_cache_capacity_dirty: false,
pending_clipboard_text: None,
available_update: None,
persist_enabled: false,
}
}
@ -1185,43 +1222,52 @@ impl AppState {
})
}
/// Shows real version status toast (5.129.0) & checks update endpoint asynchronously.
/// Shows version status toast (`APP_VERSION` = `0.1.0`) & checks `git.tatar/marwy/yandex-music-rs` latest release asynchronously.
/// If an update was already detected, clicking again opens its release page immediately.
pub fn check_for_updates(&mut self) {
if let Some((_, ref url)) = self.available_update {
open_url_in_browser(url);
}
self.show_toast(self.i18n().toast_checking_updates());
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
const LATEST_RELEASE_API: &str =
"https://git.tatar/api/v1/repos/marwy/yandex-music-rs/releases/latest";
const LATEST_RELEASE_WEB: &str =
"https://git.tatar/marwy/yandex-music-rs/releases/latest";
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(6))
.user_agent(format!("YandexMusicDesktopAppWindows/{}", APP_VERSION))
.user_agent(format!("yandex-music-rs/{}", APP_VERSION))
.build();
let res = match client {
Ok(http) => {
match http
.get("https://music-desktop-application.s3.yandex.net/stable/latest.yml")
.send()
.await
{
Ok(http) => match http.get(LATEST_RELEASE_API).send().await {
Ok(resp) if resp.status().is_success() => {
let body = resp.text().await.unwrap_or_default();
let remote_ver = body.lines().find_map(|l| {
l.trim()
.strip_prefix("version:")
.map(|v| v.trim().trim_matches('"').to_string())
});
if let Some(ref v) = remote_ver {
if v != APP_VERSION && !v.is_empty() {
Ok(Some(v.clone()))
} else {
Ok(None)
}
match resp.json::<serde_json::Value>().await {
Ok(val) => {
let tag = val["tag_name"]
.as_str()
.map(|s| s.trim().trim_start_matches(['v', 'V']).to_string())
.unwrap_or_default();
let html_url = val["html_url"]
.as_str()
.map(str::trim)
.filter(|s| !s.is_empty())
.unwrap_or(LATEST_RELEASE_WEB)
.to_string();
if !tag.is_empty() && is_newer_version(&tag, APP_VERSION) {
Ok(Some((tag, html_url)))
} else {
Ok(None)
}
}
Ok(resp) => Err(format!("HTTP {}", resp.status().as_u16())),
Err(e) => Err(e.to_string()),
}
}
Ok(resp) if resp.status().as_u16() == 404 => Ok(None),
Ok(resp) => Err(format!("HTTP {}", resp.status().as_u16())),
Err(e) => Err(e.to_string()),
},
Err(e) => Err(e.to_string()),
};
let _ = tx.send(ApiEvent::UpdateCheckFinished(res));
@ -1670,6 +1716,7 @@ impl AppState {
ApiEvent::AccountLoaded(Ok(acc)) => {
self.show_toast(t.toast_welcome(&acc.display_name));
self.account = Some(acc);
self.ensure_words_for_current_track();
}
ApiEvent::AccountLoaded(Err(e)) => {
self.show_toast(if t.is_ru() {
@ -1918,6 +1965,23 @@ impl AppState {
}
}
}
ApiEvent::WordsCardsLoaded(entries) => {
for (track_id, maybe_card) in entries {
self.words_loading_tracks.remove(&track_id);
if let Some(card) = maybe_card {
self.words_empty_tracks.remove(&track_id);
self.words_cards.insert(track_id, card);
} else {
self.words_empty_tracks.insert(track_id);
}
}
}
ApiEvent::WordsBigCardLoaded(big) => {
self.words_big_card_loading = false;
if let Some(bc) = big {
self.words_big_card = Some(bc);
}
}
ApiEvent::QueueTracksHydrated(hydrated) => {
let mut updated_any = false;
for fresh in &hydrated {
@ -1965,6 +2029,7 @@ impl AppState {
if updated_any {
self.save_playback_state();
}
self.ensure_words_for_current_track();
}
ApiEvent::OAuthTokenReceived(res) => match res {
Ok(tok) => {
@ -2120,8 +2185,14 @@ impl AppState {
}
}
ApiEvent::UpdateCheckFinished(res) => match res {
Ok(Some(newer)) => self.show_toast(t.toast_update_available(&newer)),
Ok(None) => self.show_toast(t.toast_up_to_date()),
Ok(Some((newer, url))) => {
self.available_update = Some((newer.clone(), url));
self.show_toast(t.toast_update_available(&newer));
}
Ok(None) => {
self.available_update = None;
self.show_toast(t.toast_latest_version());
}
Err(e) => {
log::warn!("Update check failed: {}", e);
self.show_toast(t.toast_update_check_failed());
@ -2604,6 +2675,20 @@ impl AppState {
AppAction::CloseTrackDetailModal => {
self.track_detail_modal = None;
}
AppAction::OpenWordsBigCard { track_id } => {
self.open_words_big_card(track_id);
}
AppAction::CloseWordsBigCard => {
self.words_big_card_open = false;
self.words_big_card_loading = false;
}
AppAction::SendWordsFeedback {
track_id,
card_id,
state,
} => {
self.send_words_feedback(track_id, card_id, state);
}
AppAction::DismissOverlays => {
self.fullscreen_open = false;
self.fullscreen_lyrics_open = false;
@ -2613,6 +2698,8 @@ impl AppState {
self.eq_popover_open = false;
self.playlist_modal = PlaylistModalState::None;
self.track_detail_modal = None;
self.words_big_card_open = false;
self.words_big_card_loading = false;
}
// Account, Settings & Lifecycle
@ -2625,7 +2712,9 @@ impl AppState {
self.config.language = lang;
self.save_config();
self.api.set_language(lang.api_code());
self.clear_words_cache();
self.bootstrap_api();
self.ensure_words_for_current_track();
}
AppAction::ToggleLanguage => {
let next = if self.config.language.is_ru() {
@ -2636,7 +2725,9 @@ impl AppState {
self.config.language = next;
self.save_config();
self.api.set_language(next.api_code());
self.clear_words_cache();
self.bootstrap_api();
self.ensure_words_for_current_track();
}
AppAction::SetAudioQuality(q) => {
self.config.audio_quality = q;
@ -2706,6 +2797,7 @@ impl AppState {
self.save_config();
self.api.set_token(None);
self.account = None;
self.clear_words_cache();
self.show_toast(t.toast_signed_out());
}
AppAction::CheckForUpdates => self.check_for_updates(),
@ -2828,3 +2920,47 @@ pub fn vibe_bucket_primary_rgb(raw_rgb: Option<[u8; 3]>) -> [u8; 3] {
[0xF5, 0x00, 0x2E] // carmine (340..360 or 0..2)
}
}
fn parse_semver_tuple(raw: &str) -> Option<(u32, u32, u32)> {
let trimmed = raw.trim().trim_start_matches(['v', 'V']);
let core = trimmed.split(['-', '+']).next()?.trim();
if core.is_empty() {
return None;
}
let mut parts = core.split('.');
let major = parts.next()?.parse::<u32>().ok()?;
let minor = match parts.next() {
Some(s) => s.parse::<u32>().ok()?,
None => 0,
};
let patch = match parts.next() {
Some(s) => s.parse::<u32>().ok()?,
None => 0,
};
Some((major, minor, patch))
}
/// Returns `true` iff `remote` is strictly newer than `current` by `(major, minor, patch)` semver comparison.
pub fn is_newer_version(remote: &str, current: &str) -> bool {
match (parse_semver_tuple(remote), parse_semver_tuple(current)) {
(Some(r), Some(c)) => r > c,
_ => false,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_newer_version_semver() {
assert_eq!(APP_VERSION, "0.1.0");
assert!(!is_newer_version("v0.1.0", "0.1.0"));
assert!(!is_newer_version("0.1.0", "0.1.0"));
assert!(is_newer_version("v0.1.1", "0.1.0"));
assert!(is_newer_version("v0.2.0", "0.1.0"));
assert!(is_newer_version("v1.0.0", "0.9.9"));
assert!(!is_newer_version("v0.0.9", "0.1.0"));
assert!(!is_newer_version("", "0.1.0"));
}
}

View file

@ -113,15 +113,24 @@ pub enum Icon {
PauseFilledXs,
LinkXxs,
YandexPlusEn,
// Dedicated Yandex ID Profile & Appearance icons
// Dedicated Yandex ID Profile & Appearance icons (v2.79.0) + WordsCard thumbs
ProfileAccountXxs,
ProfileSettingsXxs,
ProfileSupportXxs,
ProfileGlobeXxs,
ProfileAppearanceXxs,
ProfileAddAccountXxs,
ProfileLogoutXxs,
ProfilePlusXxs,
ThemeSystemXxs,
ThemeDarkXxs,
ThemeLightXxs,
ThumbUpXxs,
ThumbDownXxs,
YandexIdLogoRuDark,
YandexIdLogoRuLight,
YandexIdLogoEnDark,
YandexIdLogoEnLight,
}
impl Icon {
@ -234,13 +243,22 @@ impl Icon {
Icon::LinkXxs => include_bytes!("../assets/icons/link_xxs.svg"),
Icon::YandexPlusEn => include_bytes!("../assets/icons/yandexPlusEn.svg"),
Icon::ProfileAccountXxs => include_bytes!("../assets/icons/profile_account_xxs.svg"),
Icon::ProfileSettingsXxs => include_bytes!("../assets/icons/profile_settings_xxs.svg"),
Icon::ProfileSupportXxs => include_bytes!("../assets/icons/profile_support_xxs.svg"),
Icon::ProfileGlobeXxs => include_bytes!("../assets/icons/profile_globe_xxs.svg"),
Icon::ProfileAppearanceXxs => include_bytes!("../assets/icons/profile_appearance_xxs.svg"),
Icon::ProfileAddAccountXxs => include_bytes!("../assets/icons/profile_add_account_xxs.svg"),
Icon::ProfileLogoutXxs => include_bytes!("../assets/icons/profile_logout_xxs.svg"),
Icon::ProfilePlusXxs => include_bytes!("../assets/icons/profile_plus_xxs.svg"),
Icon::ThemeSystemXxs => include_bytes!("../assets/icons/theme_system_xxs.svg"),
Icon::ThemeDarkXxs => include_bytes!("../assets/icons/theme_dark_xxs.svg"),
Icon::ThemeLightXxs => include_bytes!("../assets/icons/theme_light_xxs.svg"),
Icon::ThumbUpXxs => include_bytes!("../assets/icons/thumb_up_xxs.svg"),
Icon::ThumbDownXxs => include_bytes!("../assets/icons/thumb_down_xxs.svg"),
Icon::YandexIdLogoRuDark => include_bytes!("../assets/icons/yandex_id_logo_ru_dark.svg"),
Icon::YandexIdLogoRuLight => include_bytes!("../assets/icons/yandex_id_logo_ru_light.svg"),
Icon::YandexIdLogoEnDark => include_bytes!("../assets/icons/yandex_id_logo_en_dark.svg"),
Icon::YandexIdLogoEnLight => include_bytes!("../assets/icons/yandex_id_logo_en_light.svg"),
}
}
@ -249,6 +267,10 @@ impl Icon {
Icon::MusicLogoLeftEn => (276, 96),
Icon::MusicLogoLeftRu => (256, 72),
Icon::YandexPlusRu | Icon::YandexPlusEn => (160, 44),
Icon::YandexIdLogoRuDark
| Icon::YandexIdLogoRuLight
| Icon::YandexIdLogoEnDark
| Icon::YandexIdLogoEnLight => (124, 60),
Icon::MusicLogo | Icon::PlayFilled | Icon::PauseFilled | Icon::PlayLarge | Icon::PauseLarge => (72, 72),
_ => (48, 48),
}
@ -368,13 +390,22 @@ impl Icon {
Icon::LinkXxs,
Icon::YandexPlusEn,
Icon::ProfileAccountXxs,
Icon::ProfileSettingsXxs,
Icon::ProfileSupportXxs,
Icon::ProfileGlobeXxs,
Icon::ProfileAppearanceXxs,
Icon::ProfileAddAccountXxs,
Icon::ProfileLogoutXxs,
Icon::ProfilePlusXxs,
Icon::ThemeSystemXxs,
Icon::ThemeDarkXxs,
Icon::ThemeLightXxs,
Icon::ThumbUpXxs,
Icon::ThumbDownXxs,
Icon::YandexIdLogoRuDark,
Icon::YandexIdLogoRuLight,
Icon::YandexIdLogoEnDark,
Icon::YandexIdLogoEnLight,
];
}

View file

@ -1,6 +1,6 @@
use std::cell::RefCell;
use crate::api::models::{format_ms, Track, VibeStationSummary};
use crate::api::models::{format_ms, Track, VibeStationSummary, WordsCard};
use crate::api::YandexApiClient;
use crate::app::i18n::APP_VERSION;
use crate::app::state::{
@ -14,8 +14,8 @@ use crate::engine::types::{
css_rgba, Color, CornerRadii, CursorKind, Pos2, Rect, Vec2, VIBE_TEXTURE_ID,
};
use crate::engine::widgets::{
draw_cover_art, ym_menu_divider, ym_menu_frame, ym_menu_item, ym_menu_item_ex,
ym_volume_capsule,
draw_cover_art, secondary_pill_button, ym_menu_divider, ym_menu_frame, ym_menu_item,
ym_menu_item_ex, ym_volume_capsule,
};
use crate::engine::UiContext;
use crate::icons::Icon;
@ -35,6 +35,8 @@ struct VibePageLocalState {
wheel_scroll_target: Option<f32>,
submenu: VibeSubmenu,
submenu_anchor_y: f32,
words_popover_open: bool,
words_popover_track_id: String,
}
impl Default for VibePageLocalState {
@ -45,10 +47,28 @@ impl Default for VibePageLocalState {
wheel_scroll_target: None,
submenu: VibeSubmenu::None,
submenu_anchor_y: 0.0,
words_popover_open: false,
words_popover_track_id: String::new(),
}
}
}
const WORDS_LOADING_PHRASES_RU: &[&str] = &[
"Собираю интересное силой ИИ",
"Настраиваюсь",
"Ловлю ритм",
"Читаю про артиста",
"Изучаю звучание",
];
const WORDS_LOADING_PHRASES_EN: &[&str] = &[
"Using the AI power to collect interesting stuff",
"Getting ready",
"Getting in the rhythm",
"Reading about the artist",
"Analyzing the sound",
];
thread_local! {
static VIBE_LOCAL: RefCell<VibePageLocalState> = RefCell::new(VibePageLocalState::default());
}
@ -234,111 +254,74 @@ pub fn render_my_vibe(
"Reset to My Vibe"
};
if is_non_vibe_context {
let ctx_style = TextStyle::bold(16.0, pal.text_bright);
let max_pill_w = (hero_rect.width() - 120.0).clamp(140.0, 420.0);
let text_w = ctx
.measure_text(&app.context_name, ctx_style, None)
.x
.min(max_pill_w - 28.0);
let pill_w = (text_w + 28.0).clamp(72.0, max_pill_w);
let total_w = pill_w + 8.0 + 28.0;
let start_x = cx - total_w * 0.5;
let pill_r = Rect::from_xywh(start_x, top_y - 16.0, pill_w, 32.0);
let pill_resp = ctx.interact(WidgetId::new("vb_ctx_source_pill"), pill_r);
let pill_bg = if pill_resp.hovered {
pal.surface_hover
if is_non_vibe_context || is_custom_vibe_station {
// Exact official 5.129.0 `.VibeResetButton_button__i8Cvy` + `.VibeResetButton_context__hsTlv`:
// ONE unified dark translucent 44px pill (radius 22px) with electric yellow 19px Headline text
// and a filled 22px yellow circle (`×` dark `#141414` inside) on the right of the SAME pill!
let pill_label = if is_non_vibe_context {
app.context_name.as_str()
} else {
pal.surface_secondary
vibe_label
};
ctx.dl().push_rect(pill_r, 16.0, pill_bg);
let yellow = if pal.is_dark {
Color::rgb(0xFF, 0xFF, 0x00)
} else {
Color::rgb(0xFF, 0xEE, 0x00)
};
let lbl_style = TextStyle::headline(19.0, yellow);
let max_pill_w = (hero_rect.width() - 80.0).clamp(160.0, 440.0);
let max_text_w = (max_pill_w - 64.0).max(40.0);
let text_w = ctx.measure_text(pill_label, lbl_style, None).x.min(max_text_w);
let pill_w = (20.0 + text_w + 10.0 + 22.0 + 12.0).clamp(96.0, max_pill_w);
let pill_r = Rect::from_center_size(Pos2::new(cx, top_y), Vec2::new(pill_w, 44.0));
let close_center = Pos2::new(pill_r.right() - 12.0 - 11.0, pill_r.center_y());
let reset_r = Rect::from_center_size(close_center, Vec2::splat(32.0));
let reset_resp = ctx.interact(WidgetId::new("vb_ctx_reset_btn"), reset_r);
let pill_resp = ctx.interact(WidgetId::new("vb_ctx_source_pill"), pill_r);
let pill_bg = if pill_resp.pressed || reset_resp.pressed {
css_rgba(0, 0, 0, 153) // rgba(0,0,0,0.60)
} else if pill_resp.hovered || reset_resp.hovered {
css_rgba(0, 0, 0, 102) // rgba(0,0,0,0.40)
} else {
css_rgba(0, 0, 0, 77) // rgba(0,0,0,0.30)
};
ctx.dl().push_rect(pill_r, 22.0, pill_bg);
ctx.draw_text_ellipsis(
&app.context_name,
ctx_style,
pill_label,
lbl_style,
Rect::from_xywh(
pill_r.left() + 14.0,
pill_r.left() + 20.0,
pill_r.top(),
(pill_r.width() - 28.0).max(20.0),
(text_w + 4.0).min(pill_r.width() - 56.0).max(20.0),
pill_r.height(),
),
TextAlign::Center,
TextAlign::Left,
);
if pill_resp.hovered {
let close_rad = if reset_resp.hovered { 11.5 } else { 11.0 };
ctx.dl().push_circle(close_center, close_rad, yellow);
ctx.draw_icon(
Icon::Close,
Rect::from_center_size(close_center, Vec2::splat(12.0)),
Color::rgb(0x14, 0x14, 0x14),
);
if reset_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
ctx.show_tooltip(reset_r, reset_tooltip);
} else if pill_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if pill_resp.clicked {
if reset_resp.clicked {
actions.push(AppAction::ResetContextToMyVibe);
} else if pill_resp.clicked {
if is_non_vibe_context {
actions.push(AppAction::NavigateToCurrentContext);
}
let reset_r = Rect::from_xywh(pill_r.right() + 8.0, top_y - 14.0, 28.0, 28.0);
let reset_resp = ctx.interact(WidgetId::new("vb_ctx_reset_btn"), reset_r);
ctx.dl().push_circle(
reset_r.center(),
14.0,
if reset_resp.hovered {
pal.surface_hover
} else {
pal.surface_secondary
},
);
ctx.draw_icon(
Icon::Close,
Rect::from_center_size(reset_r.center(), Vec2::splat(14.0)),
if reset_resp.hovered {
pal.text_bright
} else {
pal.text_secondary
},
);
if reset_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
ctx.show_tooltip(reset_r, reset_tooltip);
}
if reset_resp.clicked {
actions.push(AppAction::ResetContextToMyVibe);
}
} else if is_custom_vibe_station {
let lbl_col = if has_active_track {
pal.logo_text
} else {
pal.text_primary
};
let lbl_style = TextStyle::headline(18.0, lbl_col);
let max_lbl_w = (hero_rect.width() - 120.0).clamp(140.0, 420.0);
let text_w = ctx.measure_text(vibe_label, lbl_style, None).x.min(max_lbl_w);
let total_w = text_w + 10.0 + 28.0;
let start_x = cx - total_w * 0.5;
let lbl_r = Rect::from_xywh(start_x, top_y - 14.0, text_w + 4.0, 28.0);
ctx.draw_text_ellipsis(vibe_label, lbl_style, lbl_r, TextAlign::Center);
let reset_r = Rect::from_xywh(lbl_r.right() + 8.0, top_y - 14.0, 28.0, 28.0);
let reset_resp = ctx.interact(WidgetId::new("vb_ctx_reset_btn"), reset_r);
ctx.dl().push_circle(
reset_r.center(),
14.0,
if reset_resp.hovered {
pal.surface_hover
} else {
pal.surface_secondary
},
);
ctx.draw_icon(
Icon::Close,
Rect::from_center_size(reset_r.center(), Vec2::splat(14.0)),
if reset_resp.hovered {
pal.text_bright
} else {
pal.text_secondary
},
);
if reset_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
ctx.show_tooltip(reset_r, reset_tooltip);
}
if reset_resp.clicked {
actions.push(AppAction::ResetContextToMyVibe);
}
} else if playing_alpha > 0.005 && current_track.is_some() {
// Default My Vibe playing: top Vibe label (`pal.logo_text`: #FFFF00 dark / #000000 light)
@ -897,21 +880,80 @@ pub fn render_my_vibe(
actions.push(AppAction::Next);
}
// 8. AI METEOR GLOW SETTINGS BUTTON
// Verified verbatim from `5b3a6ee99e2bd1b8.css`:
// 8. OFFICIAL 5.129.0 `WordsCard` (AI Track Facts / Replies — `4874` mod `78572`, `5b3a6ee99e2bd1b8.css`)
// `.AiBadge_root__EfKG1 { width: 48px; height: 48px; }`
// `.AiBadge_glow__R6cQa { opacity: 0.65; transform: translate3d(-25%, -43%, 0); }`
// `.WordsCard_root__6r3u2`: 14px medium, subtle 1.02 hover scale
let ai_y = (tr_y + 100.0).min(rect.bottom() - 68.0);
let ai_rect = Rect::from_center_size(Pos2::new(cx, ai_y), Vec2::new(380.0, 48.0));
let ai_resp = ctx.interact(WidgetId::new("vb_ai_settings"), ai_rect);
let ai_hov = ctx.animate_bool(WidgetId::new("vb_ai_hov"), ai_resp.hovered, 0.18);
let ai_scale = 1.0 + 0.02 * ai_hov;
let sp_c = Pos2::new(ai_rect.left() + 29.0, ai_y);
let meteor_tex = ctx.icons.get_official_meteor_glow(&mut ctx.textures);
// Exact 180px base size at t=0 (matches lossless CDP reference) with subtle 1.0..1.04 breathing
let pulse_t = 0.5 - 0.5 * ((ctx.input.time as f32) * 1.6).cos();
// Exact 180px base size at t=0 (matches lossless CDP reference) with gentle 1.25s alternate breathing
let pulse_t = 0.5 - 0.5 * ((ctx.input.time as f32) * (std::f32::consts::TAU / 2.5)).cos();
let glow_sz = 180.0_f32 * (1.0 + 0.04 * pulse_t);
let active_words_card: Option<WordsCard> = app.current_words_card().cloned();
let feedback_msg: Option<String> = app.current_words_feedback_message().map(str::to_string);
let current_tid = current_track.as_ref().map(|tr| tr.id.as_str()).unwrap_or("");
let words_is_empty = !current_tid.is_empty() && app.words_empty_tracks.contains(current_tid);
// Auto-close WordsCard popover whenever the active track changes or feedback toast activates
VIBE_LOCAL.with(|s| {
let mut st = s.borrow_mut();
if st.words_popover_open && (st.words_popover_track_id != current_tid || feedback_msg.is_some()) {
st.words_popover_open = false;
}
});
let mut words_popover_anchor: Option<(Rect, WordsCard)> = None;
if let Some(ref msg) = feedback_msg {
// State A — Feedback toast active (< 3s): sparkle + centered feedback message (non-clickable)
let msg_style = TextStyle::medium(14.0, pal.text_primary);
let msg_w = ctx
.measure_text(msg, msg_style, None)
.x
.min((hero_rect.width() - 120.0).max(160.0));
let block_w = 44.0 + msg_w;
let block_l = cx - block_w * 0.5;
let sp_c = Pos2::new(block_l + 18.0, ai_y);
let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
let meteor_r = Rect::from_xywh(
badge_tl.x - glow_sz * 0.25,
badge_tl.y - glow_sz * 0.43,
glow_sz,
glow_sz,
);
ctx.dl()
.push_image(meteor_r, meteor_tex, 0.0, Color::WHITE.with_alpha(166));
ctx.draw_icon(
Icon::AiSparkles,
Rect::from_center_size(sp_c, Vec2::splat(24.0)),
pal.text_bright,
);
ctx.draw_text_ellipsis(
msg,
msg_style,
Rect::from_xywh(block_l + 40.0, ai_y - 16.0, msg_w + 8.0, 32.0),
TextAlign::Left,
);
ctx.request_repaint_after(std::time::Duration::from_millis(250));
} else if let Some(ref card) = active_words_card.as_ref().filter(|c| !c.is_disliked()) {
// State B — Real `WordsCard` loaded for current track & not disliked!
let max_card_w = (hero_rect.width() - 64.0).clamp(320.0, 480.0);
let text_max_w = (max_card_w - 60.0).max(200.0);
let text_style_base = TextStyle::medium(14.0, pal.text_primary).with_line_height(19.0);
let measured_text = ctx.measure_text(&card.text, text_style_base, Some(text_max_w));
let text_h = measured_text.y.clamp(20.0, 58.0);
let has_action = card.action.is_some();
let action_h = if has_action { 22.0 } else { 0.0 };
let card_h = (text_h + action_h + 10.0).clamp(48.0, 92.0);
let card_w = (measured_text.x + 64.0).clamp(240.0, max_card_w);
let card_cy = ai_y.min(rect.bottom() - card_h * 0.5 - 12.0);
let card_r = Rect::from_center_size(Pos2::new(cx, card_cy), Vec2::new(card_w, card_h));
let card_resp = ctx.interact(WidgetId::new("vb_words_card"), card_r);
let ai_hov = ctx.animate_bool(WidgetId::new("vb_words_hov"), card_resp.hovered, 0.18);
let ai_scale = 1.0 + 0.02 * ai_hov;
let sp_c = Pos2::new(card_r.left() + 24.0, card_r.center_y());
let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
let meteor_r = Rect::from_xywh(
badge_tl.x - glow_sz * 0.25,
@ -926,54 +968,163 @@ pub fn render_my_vibe(
Rect::from_center_size(sp_c, Vec2::splat(24.0 * ai_scale)),
pal.text_bright,
);
let ai_lead = if ru { "Настроить " } else { "Using the " };
let ai_rest = if ru {
"Мою волну по настроению и характеру"
} else {
"AI power to collect interesting stuff"
};
let ai_fs = 14.0 * ai_scale;
let ai_spans = [
RichSpan::new(
ai_lead,
TextStyle::medium(
ai_fs,
if ai_resp.hovered {
pal.text_primary
} else {
pal.text_secondary
},
),
),
RichSpan::new(
ai_rest,
TextStyle::medium(
ai_fs,
if ai_resp.hovered {
let text_x = card_r.left() + 50.0;
let text_w = (card_r.right() - text_x - 8.0).max(120.0);
let text_top = card_r.center_y() - (text_h + action_h) * 0.5;
let card_text_col = if card_resp.hovered {
pal.text_bright
} else {
pal.text_primary
};
let card_text_style = TextStyle::medium(14.0 * ai_scale, card_text_col)
.with_line_height(19.0 * ai_scale);
ctx.draw_text_wrapped(
&card.text,
card_text_style,
Rect::from_xywh(text_x, text_top, text_w, text_h + 4.0),
Some(3),
TextAlign::Left,
);
let mut action_clicked = false;
if let Some(ref act) = card.action {
let act_r = Rect::from_xywh(text_x, text_top + text_h + 2.0, text_w, 20.0);
let act_resp = ctx.interact(WidgetId::new("vb_words_action"), act_r);
ctx.draw_text_ellipsis(
&act.title,
TextStyle::medium(
13.0,
if act_resp.hovered {
pal.text_bright
} else {
pal.logo_text
},
),
),
];
act_r,
TextAlign::Left,
);
if act_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if act_resp.clicked && !act.url.is_empty() {
actions.push(AppAction::OpenUrl(act.url.clone()));
action_clicked = true;
}
}
if card_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if card_resp.clicked && !action_clicked {
if card.has_big_card() {
VIBE_LOCAL.with(|s| s.borrow_mut().words_popover_open = false);
actions.push(AppAction::OpenWordsBigCard {
track_id: card.track_id.clone(),
});
} else {
shell.close_all_menus();
VIBE_LOCAL.with(|s| {
let mut st = s.borrow_mut();
st.words_popover_open = !st.words_popover_open;
st.words_popover_track_id = card.track_id.clone();
});
}
}
words_popover_anchor = Some((card_r, (*card).clone()));
} else if words_is_empty || active_words_card.as_ref().map_or(false, |c| c.is_disliked()) {
// State C — Resolved empty OR card disliked: centered dimmed sparkle badge (opacity 0.50, non-clickable)
let sp_c = Pos2::new(cx, ai_y);
let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
let meteor_r = Rect::from_xywh(
badge_tl.x - glow_sz * 0.25,
badge_tl.y - glow_sz * 0.43,
glow_sz,
glow_sz,
);
ctx.dl()
.push_image(meteor_r, meteor_tex, 0.0, Color::WHITE.with_alpha(72));
ctx.draw_icon(
Icon::AiSparkles,
Rect::from_center_size(sp_c, Vec2::splat(24.0)),
pal.text_bright.scale_alpha(0.50),
);
} else {
// State D — Loading OR offline visual fixture: official rotating 5.129.0 `words.loading-phrase-*`
// (Index 0 at `t == 0.0` matches `my_vibe.jpg` & lossless CDP `test_ext_02` pixel-for-pixel;
// clicking while loading does NOTHING — zero fake Vibe-settings modal!)
let ai_rect = Rect::from_center_size(Pos2::new(cx, ai_y), Vec2::new(380.0, 48.0));
let sp_c = Pos2::new(ai_rect.left() + 29.0, ai_y);
let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
let meteor_r = Rect::from_xywh(
badge_tl.x - glow_sz * 0.25,
badge_tl.y - glow_sz * 0.43,
glow_sz,
glow_sz,
);
ctx.dl()
.push_image(meteor_r, meteor_tex, 0.0, Color::WHITE.with_alpha(166));
ctx.draw_icon(
Icon::AiSparkles,
Rect::from_center_size(sp_c, Vec2::splat(24.0)),
pal.text_bright,
);
let phrases = if ru {
WORDS_LOADING_PHRASES_RU
} else {
WORDS_LOADING_PHRASES_EN
};
let phrase_idx = if ctx.input.time <= 0.001 {
0
} else {
((ctx.input.time / 2.5).floor() as usize) % phrases.len()
};
let ai_text_r = Rect::from_xywh(
ai_rect.left() + 56.0,
ai_rect.top(),
ai_rect.width() - 60.0,
ai_rect.height(),
);
if phrase_idx == 0 {
let (lead, rest) = if ru {
("Собираю ", "интересное силой ИИ")
} else {
("Using the ", "AI power to collect interesting stuff")
};
let ai_spans = [
RichSpan::new(lead, TextStyle::medium(14.0, pal.text_secondary)),
RichSpan::new(rest, TextStyle::medium(14.0, pal.text_primary)),
];
ctx.draw_rich_text(&ai_spans, ai_text_r, Some(1), TextAlign::Left);
if ai_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
} else {
ctx.draw_text_ellipsis(
phrases[phrase_idx],
TextStyle::medium(14.0, pal.text_primary),
ai_text_r,
TextAlign::Left,
);
}
if ctx.input.time > 0.001 && !current_tid.is_empty() && app.words_loading_tracks.contains(current_tid) {
ctx.request_repaint_after(std::time::Duration::from_millis(80));
}
if ai_resp.clicked {
actions.push(AppAction::SetVibeModalOpen(true));
}
// 9. BOTTOM-RIGHT VERSION BADGE (`5.129.0`, theme-aware `pal.surface_secondary` + `pal.text_secondary`)
let ver_style = TextStyle::medium(13.0, pal.text_secondary);
let ver_w = (ctx.measure_text(APP_VERSION, ver_style, None).x + 22.0)
// 9. BOTTOM-RIGHT VERSION BADGE (`APP_VERSION` = `0.1.0`, or `0.1.0 → {ver}` when update available!)
let (ver_label, ver_col) = if let Some((ref new_ver, _)) = app.available_update {
(
format!("{} → {}", APP_VERSION, new_ver),
if pal.is_dark {
pal.yellow
} else {
pal.outline_selected
},
)
} else {
(APP_VERSION.to_string(), pal.text_secondary)
};
let ver_style = TextStyle::medium(13.0, ver_col);
let ver_w = (ctx.measure_text(&ver_label, ver_style, None).x + 22.0)
.max(68.0)
.ceil();
let ver_r = Rect::from_xywh(
@ -992,7 +1143,7 @@ pub fn render_my_vibe(
pal.surface_secondary
},
);
ctx.draw_text_ellipsis(APP_VERSION, ver_style, ver_r, TextAlign::Center);
ctx.draw_text_ellipsis(&ver_label, ver_style, ver_r, TextAlign::Center);
if ver_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
@ -1340,6 +1491,479 @@ pub fn render_my_vibe(
actions,
);
}
// 12. OFFICIAL 5.129.0 `WordsCardPopoverDesktop` (floating 12px above `WordsCard`, `ZLayer::Popover`)
let words_pop_open = VIBE_LOCAL.with(|s| s.borrow().words_popover_open);
if words_pop_open {
if let Some((anchor_r, ref card)) = words_popover_anchor {
render_words_card_popover(ctx, pal, ru, anchor_r, card, actions);
} else {
VIBE_LOCAL.with(|s| s.borrow_mut().words_popover_open = false);
}
}
// 13. OFFICIAL 5.129.0 `WordsCardFullscreen` (`ZLayer::Modal` when `app.words_big_card_open`)
if app.words_big_card_open {
render_words_card_fullscreen(ctx, pal, app, ru, active_words_card.as_ref(), actions);
}
}
fn render_words_card_popover(
ctx: &mut UiContext,
pal: &YmPalette,
ru: bool,
anchor_rect: Rect,
card: &WordsCard,
actions: &mut Vec<AppAction>,
) {
let pop_w = 260.0_f32;
let item_h = 36.0_f32;
let div_h = 13.0_f32;
let src_count = card.actions.len().min(5);
let mut pop_h = 16.0 + 2.0 * item_h;
if src_count > 0 {
pop_h += src_count as f32 * item_h + div_h;
}
let disclaimer_text = if ru {
"AI может ошибаться, проверяйте важное"
} else {
"AI may make mistakes, be sure to double-check important information"
};
let disclaimer_h = if card.is_fact() {
let mh = ctx
.measure_text(
disclaimer_text,
TextStyle::regular(12.0, pal.text_secondary).with_line_height(16.0),
Some(pop_w - 32.0),
)
.y
.clamp(18.0, 40.0);
pop_h += div_h + mh + 8.0;
mh
} else {
0.0
};
let screen = ctx.screen_rect();
let pop_x = (anchor_rect.center_x() - pop_w * 0.5)
.clamp(screen.left() + 12.0, (screen.right() - pop_w - 12.0).max(screen.left() + 12.0));
let pop_y = (anchor_rect.top() - pop_h - 12.0).clamp(40.0, (screen.bottom() - pop_h - 12.0).max(40.0));
let pop_rect = Rect::from_xywh(pop_x, pop_y, pop_w, pop_h);
let mut close_pop = false;
ctx.with_layer(ZLayer::Popover, |ctx| {
let inner = ym_menu_frame(ctx, pal, pop_rect);
let mut y = inner.top();
let w = inner.width();
if src_count > 0 {
for (idx, src) in card.actions.iter().take(src_count).enumerate() {
let r = Rect::from_xywh(inner.left(), y, w, item_h);
y += item_h;
if ym_menu_item(
ctx,
pal,
WidgetId::from_pair("wcp_src", idx),
r,
Icon::LinkXxs,
&src.title,
false,
false,
)
.clicked
{
if !src.url.is_empty() {
actions.push(AppAction::OpenUrl(src.url.clone()));
}
close_pop = true;
}
}
ym_menu_divider(ctx, pal, Rect::from_xywh(inner.left(), y, w, div_h));
y += div_h;
}
let like_lbl = if ru {
"Больше такого"
} else {
"More similar replies"
};
let dislike_lbl = if ru { "Мимо" } else { "Not cool" };
let r_like = Rect::from_xywh(inner.left(), y, w, item_h);
y += item_h;
if ym_menu_item(
ctx,
pal,
WidgetId::new("wcp_like"),
r_like,
Icon::ThumbUpXxs,
like_lbl,
card.is_liked(),
false,
)
.clicked
{
actions.push(AppAction::SendWordsFeedback {
track_id: card.track_id.clone(),
card_id: card.id.clone(),
state: if card.is_liked() {
"neutral".into()
} else {
"like".into()
},
});
close_pop = true;
}
let r_dislike = Rect::from_xywh(inner.left(), y, w, item_h);
y += item_h;
if ym_menu_item(
ctx,
pal,
WidgetId::new("wcp_dislike"),
r_dislike,
Icon::ThumbDownXxs,
dislike_lbl,
card.is_disliked(),
false,
)
.clicked
{
actions.push(AppAction::SendWordsFeedback {
track_id: card.track_id.clone(),
card_id: card.id.clone(),
state: "dislike".into(),
});
close_pop = true;
}
if card.is_fact() {
ym_menu_divider(ctx, pal, Rect::from_xywh(inner.left(), y, w, div_h));
y += div_h + 2.0;
ctx.draw_text_wrapped(
disclaimer_text,
TextStyle::regular(12.0, pal.text_secondary).with_line_height(16.0),
Rect::from_xywh(inner.left() + 8.0, y, w - 16.0, disclaimer_h + 4.0),
Some(3),
TextAlign::Center,
);
}
if ctx.input.clicked_outside_any(&[pop_rect, anchor_rect])
|| ctx.input.key_pressed(Key::Escape)
{
close_pop = true;
}
});
if close_pop {
VIBE_LOCAL.with(|s| s.borrow_mut().words_popover_open = false);
}
}
fn render_words_card_fullscreen(
ctx: &mut UiContext,
pal: &YmPalette,
app: &AppState,
ru: bool,
fallback_card: Option<&WordsCard>,
actions: &mut Vec<AppAction>,
) {
let screen = ctx.screen_rect();
let mut should_close = false;
ctx.with_layer(ZLayer::Modal, |ctx| {
ctx.register_blocker(screen);
ctx.dl().push_backdrop_blur(
screen,
0.0,
4.0,
pal.bg_overlay,
0.0,
Color::TRANSPARENT,
);
// Top-right circular Close `×` button
let close_r = Rect::from_center_size(
Pos2::new(screen.right() - 40.0, screen.top() + 56.0),
Vec2::splat(40.0),
);
let close_resp = ctx.interact(WidgetId::new("wcf_close"), close_r);
ctx.dl().push_circle(
close_r.center(),
20.0,
if close_resp.hovered {
pal.surface_hover
} else {
pal.surface_secondary
},
);
ctx.draw_icon(
Icon::Close,
Rect::from_center_size(close_r.center(), Vec2::splat(18.0)),
if close_resp.hovered {
pal.text_bright
} else {
pal.text_primary
},
);
if close_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if close_resp.clicked {
should_close = true;
}
let col_w = (screen.width() - 96.0).clamp(300.0, 540.0);
let modal_h = (screen.height() - 140.0).clamp(320.0, 580.0);
let content_rect = Rect::from_center_size(screen.center(), Vec2::new(col_w + 48.0, modal_h));
let col_x = content_rect.center_x() - col_w * 0.5;
let mut y = content_rect.top() + 18.0;
// Top AI sparkle badge with soft meteor glow
let sp_c = Pos2::new(content_rect.center_x(), y + 20.0);
let meteor_tex = ctx.icons.get_official_meteor_glow(&mut ctx.textures);
let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
ctx.dl().push_image(
Rect::from_xywh(badge_tl.x - 180.0 * 0.25, badge_tl.y - 180.0 * 0.43, 180.0, 180.0),
meteor_tex,
0.0,
Color::WHITE.with_alpha(150),
);
ctx.draw_icon(
Icon::AiSparkles,
Rect::from_center_size(sp_c, Vec2::splat(28.0)),
pal.text_bright,
);
y += 64.0;
if app.words_big_card_loading {
// 3 subtle animated shimmer bars while `POST /words/big-cards` loads
let shimmer = 0.5 + 0.5 * ((ctx.input.time as f32) * 3.2).sin();
let a = (28.0 + 36.0 * shimmer).round() as u8;
let bar_col = if pal.is_dark {
css_rgba(255, 255, 255, a)
} else {
css_rgba(0, 0, 0, a)
};
for (i, frac) in [0.88_f32, 1.0_f32, 0.64_f32].iter().enumerate() {
let bw = col_w * frac;
let br = Rect::from_xywh(
content_rect.center_x() - bw * 0.5,
y + i as f32 * 30.0,
bw,
18.0,
);
ctx.dl().push_rect(br, 9.0, bar_col);
}
ctx.request_repaint();
} else {
let full_text = app
.words_big_card
.as_ref()
.map(|b| b.text.as_str())
.filter(|s| !s.is_empty())
.or_else(|| fallback_card.map(|c| c.text.as_str()))
.unwrap_or("");
let sources = app
.words_big_card
.as_ref()
.filter(|b| !b.actions.is_empty())
.map(|b| b.actions.as_slice())
.or_else(|| fallback_card.map(|c| c.actions.as_slice()))
.unwrap_or(&[]);
let bottom_reserved = if sources.is_empty() { 104.0 } else { 154.0 };
let text_vp_h = (content_rect.bottom() - y - bottom_reserved).max(120.0);
let text_vp = Rect::from_xywh(col_x, y, col_w, text_vp_h);
let text_style = TextStyle::bold(20.0, pal.text_bright).with_line_height(28.0);
let measured = ctx.measure_text(full_text, text_style, Some(col_w));
let scroll_id = WidgetId::new("wcf_text_scroll");
let scroll_y = ctx.begin_scroll_v(scroll_id, text_vp, 0.0);
let ty = if measured.y < text_vp_h {
text_vp.center_y() - measured.y * 0.5
} else {
text_vp.top() - scroll_y
};
ctx.draw_text_wrapped(
full_text,
text_style,
Rect::from_xywh(col_x, ty, col_w, measured.y + 12.0),
None,
TextAlign::Center,
);
ctx.end_scroll_v(scroll_id, pal, measured.y + 16.0, false);
y = text_vp.bottom() + 16.0;
// Optional source link pills
if !sources.is_empty() {
let mut sx = col_x;
let max_right = col_x + col_w;
for (idx, src) in sources.iter().take(4).enumerate() {
let est_w = (ctx
.measure_text(&src.title, TextStyle::medium(13.5, pal.text_primary), None)
.x
+ 50.0)
.clamp(80.0, col_w);
if sx + est_w > max_right && sx > col_x {
break;
}
let (resp, r) = secondary_pill_button(
ctx,
pal,
WidgetId::from_pair("wcf_src", idx),
Pos2::new(sx, y),
Some(Icon::LinkXxs),
&src.title,
34.0,
false,
);
if resp.clicked && !src.url.is_empty() {
actions.push(AppAction::OpenUrl(src.url.clone()));
}
sx = r.right() + 8.0;
}
y += 46.0;
}
// Horizontal feedback bar: 👍 More similar replies | 1px divider | 👎 Not cool
if let Some(card) = fallback_card {
let like_lbl = if ru {
"Больше такого"
} else {
"More similar replies"
};
let dislike_lbl = if ru { "Мимо" } else { "Not cool" };
let btn_h = 38.0;
let like_w = (ctx
.measure_text(like_lbl, TextStyle::medium(14.0, pal.text_primary), None)
.x
+ 54.0)
.max(120.0);
let dislike_w = (ctx
.measure_text(dislike_lbl, TextStyle::medium(14.0, pal.text_primary), None)
.x
+ 54.0)
.max(100.0);
let bar_w = like_w + 25.0 + dislike_w;
let bar_x = content_rect.center_x() - bar_w * 0.5;
let like_r = Rect::from_xywh(bar_x, y, like_w, btn_h);
let like_resp = ctx.interact(WidgetId::new("wcf_like"), like_r);
ctx.dl().push_rect(
like_r,
19.0,
if like_resp.hovered || card.is_liked() {
pal.surface_hover
} else {
pal.surface_secondary
},
);
let like_fg = if card.is_liked() || like_resp.hovered {
pal.text_bright
} else {
pal.text_primary
};
ctx.draw_icon(
Icon::ThumbUpXxs,
Rect::from_center_size(Pos2::new(like_r.left() + 22.0, like_r.center_y()), Vec2::splat(18.0)),
like_fg,
);
ctx.draw_text_ellipsis(
like_lbl,
TextStyle::medium(14.0, like_fg),
Rect::from_xywh(like_r.left() + 38.0, like_r.top(), like_r.width() - 48.0, like_r.height()),
TextAlign::Left,
);
if like_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if like_resp.clicked {
actions.push(AppAction::SendWordsFeedback {
track_id: card.track_id.clone(),
card_id: card.id.clone(),
state: if card.is_liked() {
"neutral".into()
} else {
"like".into()
},
});
}
// 1px vertical divider
let div_x = like_r.right() + 12.0;
ctx.dl().push_rect(
Rect::from_xywh(div_x, y + 7.0, 1.0, 24.0),
0.0,
pal.border_subtle,
);
let dislike_r = Rect::from_xywh(div_x + 13.0, y, dislike_w, btn_h);
let dislike_resp = ctx.interact(WidgetId::new("wcf_dislike"), dislike_r);
ctx.dl().push_rect(
dislike_r,
19.0,
if dislike_resp.hovered || card.is_disliked() {
pal.surface_hover
} else {
pal.surface_secondary
},
);
let dislike_fg = if card.is_disliked() || dislike_resp.hovered {
pal.text_bright
} else {
pal.text_primary
};
ctx.draw_icon(
Icon::ThumbDownXxs,
Rect::from_center_size(Pos2::new(dislike_r.left() + 22.0, dislike_r.center_y()), Vec2::splat(18.0)),
dislike_fg,
);
ctx.draw_text_ellipsis(
dislike_lbl,
TextStyle::medium(14.0, dislike_fg),
Rect::from_xywh(dislike_r.left() + 38.0, dislike_r.top(), dislike_r.width() - 48.0, dislike_r.height()),
TextAlign::Left,
);
if dislike_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if dislike_resp.clicked {
actions.push(AppAction::SendWordsFeedback {
track_id: card.track_id.clone(),
card_id: card.id.clone(),
state: "dislike".into(),
});
}
y += btn_h + 18.0;
}
// Bottom AI disclaimer
let disclaimer = if ru {
"AI может ошибаться, проверяйте важное"
} else {
"AI may make mistakes, be sure to double-check important information"
};
ctx.draw_text_wrapped(
disclaimer,
TextStyle::regular(12.5, pal.text_secondary).with_line_height(17.0),
Rect::from_xywh(col_x, y, col_w, 36.0),
Some(2),
TextAlign::Center,
);
}
if ctx.input.key_pressed(Key::Escape)
|| ctx.input.clicked_outside_any(&[content_rect, close_r])
{
should_close = true;
}
});
if should_close {
actions.push(AppAction::CloseWordsBigCard);
}
}
#[allow(clippy::too_many_arguments)]

View file

@ -67,6 +67,7 @@ pub struct ShellUiState {
pub entity_share_submenu_open: bool,
pub sidebar_profile_open: bool,
pub sidebar_appearance_open: bool,
pub sidebar_lang_open: bool,
pub sidebar_pin_menu: Option<(usize, Pos2)>,
pub vibe_menu_open: bool,
pub vibe_vol_open: bool,
@ -172,6 +173,7 @@ impl ShellUiState {
self.entity_share_submenu_open = false;
self.sidebar_profile_open = false;
self.sidebar_appearance_open = false;
self.sidebar_lang_open = false;
self.sidebar_pin_menu = None;
self.vibe_menu_open = false;
self.vibe_vol_open = false;

View file

@ -622,9 +622,9 @@ pub fn render_settings(
y += sc_h + 14.0;
// -------------------------------------------------------------------------
// 7. About 5.129.0 & Cache
// 7. About & Updates (`git.tatar/marwy/yandex-music-rs`) & Cache
// -------------------------------------------------------------------------
let about_h = 148.0;
let about_h = 172.0;
let about_inner = draw_settings_card(
ctx,
pal,
@ -634,9 +634,9 @@ pub fn render_settings(
{
let mut cy = about_inner.top();
let ver_str = if ru {
format!("Яндекс Музыка · Версия {}", APP_VERSION)
format!("yandex-music-rs · Версия {}", APP_VERSION)
} else {
format!("Yandex Music · Version {}", APP_VERSION)
format!("yandex-music-rs · Version {}", APP_VERSION)
};
ctx.draw_text_ellipsis(
&ver_str,
@ -645,10 +645,41 @@ pub fn render_settings(
TextAlign::Left,
);
cy += 24.0;
let cache_str = if ru {
format!("© Яндекс · Кэш обложек: {} шт.", covers.len())
let repo_label = "git.tatar/marwy/yandex-music-rs";
let repo_w = ctx
.measure_text(repo_label, TextStyle::medium(13.0, pal.text_secondary), None)
.x
+ 8.0;
let repo_r = Rect::from_xywh(about_inner.left(), cy, repo_w.min(about_inner.width()), 20.0);
let repo_resp = ctx.interact(WidgetId::new("set_repo_link"), repo_r);
ctx.draw_text_ellipsis(
repo_label,
TextStyle::medium(
13.0,
if repo_resp.hovered {
pal.text_bright
} else if pal.is_dark {
pal.yellow
} else {
format!("© Yandex · Cover cache: {} items", covers.len())
pal.outline_selected
},
),
repo_r,
TextAlign::Left,
);
if repo_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if repo_resp.clicked {
actions.push(AppAction::OpenUrl(
"https://git.tatar/marwy/yandex-music-rs".into(),
));
}
cy += 22.0;
let cache_str = if ru {
format!("Кэш обложек: {} шт.", covers.len())
} else {
format!("Cover cache: {} items", covers.len())
};
ctx.draw_text_ellipsis(
&cache_str,
@ -658,19 +689,26 @@ pub fn render_settings(
);
cy += 28.0;
let upd_label = if let Some((ref new_ver, _)) = app.available_update {
if ru {
format!("Обновить до {}", new_ver)
} else {
format!("Update to {}", new_ver)
}
} else if ru {
"Проверить обновления".to_string()
} else {
"Check for updates".to_string()
};
let (upd_resp, upd_r) = secondary_pill_button(
ctx,
pal,
WidgetId::new("set_check_updates"),
Pos2::new(about_inner.left(), cy),
None,
if ru {
"Проверить обновления"
} else {
"Check for updates"
},
&upd_label,
36.0,
false,
app.available_update.is_some(),
);
if upd_resp.clicked {
actions.push(AppAction::CheckForUpdates);

View file

@ -1,9 +1,8 @@
use crate::app::{AppAction, AppState, Route};
use crate::config::{PinnedItem, ThemeMode};
use crate::config::{Language, PinnedItem, ThemeMode};
use crate::covers::CoverCache;
use crate::engine::widgets::{
draw_cover_art, draw_plus_avatar_ring, draw_plus_badge, ym_menu_frame, ym_menu_item,
ym_menu_item_ex,
};
use crate::engine::{
css_rgba, Color, CursorKind, Pos2, Rect, TextAlign, TextStyle, UiContext, Vec2, WidgetId,
@ -589,7 +588,17 @@ pub fn render_sidebar(
}
if shell.sidebar_profile_open {
render_profile_card_popup(ctx, pal, app, shell, sidebar_rect, footer_rect, profile_hit, actions);
render_profile_card_popup(
ctx,
pal,
covers,
app,
shell,
sidebar_rect,
footer_rect,
profile_hit,
actions,
);
}
}
@ -616,11 +625,14 @@ fn is_pin_active_route(pin: &PinnedItem, app: &AppState) -> bool {
}
}
/// 100% Theme-aware Yandex ID Profile Card Popup + 3-way Appearance Submenu (`Как в системе` / `Тёмная` / `Светлая`)
/// 1-to-1 Official Yandex ID `/music` Account Popup (v2.79.0) — Dark & Light themes,
/// exact surface/text/hover tokens, centered 56px Plus-ring avatar, dynamic Appearance icon,
/// Language popover (`ru`/`en`), and 3-way Appearance popover (`Всегда светлый` / `Всегда тёмный` / `Как в системе`).
#[allow(clippy::too_many_arguments)]
fn render_profile_card_popup(
ctx: &mut UiContext,
pal: &YmPalette,
covers: &mut CoverCache,
app: &AppState,
shell: &mut ShellUiState,
sidebar_rect: Rect,
@ -630,118 +642,233 @@ fn render_profile_card_popup(
) {
let i18n = app.i18n();
let ru = i18n.is_ru();
let is_dark = pal.is_dark;
let has_plus = app.account.as_ref().map_or(false, |a| a.has_plus);
let logged_in = app.account.is_some();
// Exact Yandex ID v2.79.0 Surface & Color Tokens (`307ea1c94a69877eefe9.css`)
let card_bg = if is_dark {
Color::rgb(0x1F, 0x1F, 0x24)
} else {
Color::WHITE
};
let card_border = if is_dark {
Color::rgb(0x33, 0x33, 0x33)
} else {
Color::rgb(0xE6, 0xE6, 0xE6)
};
let popover_bg = if is_dark {
Color::rgb(0x2D, 0x2D, 0x34)
} else {
Color::WHITE
};
let popover_border = if is_dark {
css_rgba(250, 250, 255, 26)
} else {
Color::rgb(0xE6, 0xE6, 0xE6)
};
let id_text_primary = if is_dark {
Color::rgb(0xFA, 0xFA, 0xFF)
} else {
Color::rgb(0x26, 0x26, 0x33)
};
let id_text_secondary = if is_dark {
css_rgba(240, 240, 255, 118)
} else {
Color::rgb(0x85, 0x88, 0x9E)
};
let id_row_hover = if is_dark {
css_rgba(250, 250, 255, 20)
} else {
css_rgba(180, 184, 204, 36)
};
let id_separator = if is_dark {
css_rgba(250, 250, 255, 22)
} else {
css_rgba(38, 38, 51, 22)
};
let card_w = 320.0;
let header_h = if logged_in { 88.0 } else { 154.0 };
let rows_h = 50.0 // Plus row with subtitle
+ 40.0 * 4.0 // Account, Settings, Support, Language
+ 13.0 // divider
+ 40.0 // Appearance
+ if logged_in { 40.0 } else { 0.0 }; // Sign out
let card_h = 20.0 + header_h + rows_h + 20.0;
let header_h = if logged_in { 144.0 } else { 198.0 };
let group1_h = 54.0 + if logged_in { 44.0 * 4.0 } else { 44.0 * 2.0 };
let sep_h = 13.0; // 6px top + 1px line + 6px bottom
let group2_h = 44.0;
let group3_h = if logged_in { sep_h + 44.0 * 2.0 } else { 0.0 };
let card_h = header_h + group1_h + sep_h + group2_h + group3_h + 10.0;
let screen = ctx.screen_rect();
let card_x = (sidebar_rect.left() + 20.0).min((screen.right() - card_w - 12.0).max(8.0));
let card_y = (footer_rect.top() - card_h - 10.0).clamp(40.0, (screen.bottom() - card_h - 12.0).max(40.0));
let card_y =
(footer_rect.top() - card_h - 10.0).clamp(40.0, (screen.bottom() - card_h - 12.0).max(40.0));
let card_rect = Rect::from_xywh(card_x, card_y, card_w, card_h);
let mut close_popup = false;
let mut lang_row_rect = Rect::ZERO;
let mut appearance_row_rect = Rect::ZERO;
ctx.with_layer(ZLayer::Popover, |ctx| {
ctx.register_blocker(card_rect);
// Card container: exact `pal.profile_bg` (`#121212` dark / `#FFFFFF` light) + `pal.border_control`!
// Card container: exact `24px` radius, `card_bg`, `1px` `card_border`, elevation shadow
ctx.dl()
.push_shadow(card_rect, 24.0, 24.0, 0.0, Vec2::new(0.0, 6.0), pal.shadow_modal);
.push_shadow(card_rect, 24.0, 28.0, 0.0, Vec2::new(0.0, 8.0), pal.shadow_modal);
ctx.dl()
.push_rect_bordered(card_rect, 24.0, pal.profile_bg, 1.0, pal.border_control);
.push_rect_bordered(card_rect, 24.0, card_bg, 1.0, card_border);
let inner = card_rect.shrink(20.0);
let mut y = inner.top();
// 1. Top Overlay Bar (`_overlap_1v1kx_1`): 41×20 Yandex ID vector logo + 32×32 circular Close `×`
let logo_r = Rect::from_xywh(card_rect.left() + 16.0, card_rect.top() + 16.0, 41.0, 20.0);
let logo_icon = match (ru, is_dark) {
(true, true) => Icon::YandexIdLogoRuDark,
(true, false) => Icon::YandexIdLogoRuLight,
(false, true) => Icon::YandexIdLogoEnDark,
(false, false) => Icon::YandexIdLogoEnLight,
};
let logo_resp = ctx.interact(WidgetId::new("prof_yid_logo"), logo_r);
ctx.draw_icon(logo_icon, logo_r, Color::WHITE);
if logo_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if logo_resp.clicked {
actions.push(AppAction::OpenUrl("https://id.yandex.ru".into()));
close_popup = true;
}
// Top row: Yandex ID badge + Close `×`
let badge_cy = y + 11.0;
ctx.dl()
.push_circle(Pos2::new(inner.left() + 11.0, badge_cy), 10.0, Color::rgb(0xFC, 0x3F, 0x1D));
ctx.draw_text_ellipsis(
if ru { "Я" } else { "Y" },
TextStyle::bold(12.0, Color::WHITE),
Rect::from_center_size(Pos2::new(inner.left() + 11.0, badge_cy), Vec2::splat(20.0)),
TextAlign::Center,
);
let id_pill = Rect::from_xywh(inner.left() + 24.0, y + 1.0, 24.0, 20.0);
ctx.dl().push_rect(id_pill, 6.0, pal.text_bright);
ctx.draw_text_ellipsis(
"ID",
TextStyle::bold(11.0, pal.profile_bg),
id_pill,
TextAlign::Center,
);
let close_r = Rect::from_xywh(inner.right() - 26.0, y - 2.0, 26.0, 26.0);
let close_r = Rect::from_xywh(card_rect.right() - 44.0, card_rect.top() + 10.0, 32.0, 32.0);
let close_resp = ctx.interact(WidgetId::new("prof_card_close"), close_r);
if close_resp.hovered {
ctx.dl().push_circle(close_r.center(), 13.0, pal.surface_hover);
ctx.dl().push_circle(close_r.center(), 16.0, id_row_hover);
ctx.set_cursor(CursorKind::Pointer);
}
ctx.draw_icon(
Icon::Close,
Rect::from_center_size(close_r.center(), Vec2::splat(16.0)),
pal.text_primary,
Rect::from_center_size(close_r.center(), Vec2::splat(18.0)),
if close_resp.hovered {
id_text_primary
} else {
id_text_secondary
},
);
if close_resp.clicked {
close_popup = true;
}
y += 32.0;
// Account info OR Guest login prompt
// 2. Header: Logged In (`cv`) vs Logged Out (`Av`)
let mut y = card_rect.top() + header_h;
if let Some(ref acc) = app.account {
let avatar_center = Pos2::new(card_rect.center_x(), card_rect.top() + 20.0 + 28.0);
if acc.has_plus {
draw_plus_avatar_ring(ctx, avatar_center, 31.0, 2.0);
ctx.dl().push_circle(avatar_center, 29.0, card_bg);
}
let av_rect = Rect::from_center_size(avatar_center, Vec2::splat(56.0));
if acc.avatar_uri.is_some() {
draw_cover_art(
ctx,
pal,
covers,
av_rect,
acc.avatar_uri.as_deref(),
"profile_popup_avatar",
28.0,
true,
false,
);
} else {
ctx.dl().push_circle(
avatar_center,
28.0,
if is_dark {
Color::rgb(0x32, 0x32, 0x3B)
} else {
Color::rgb(0xEB, 0xEC, 0xF2)
},
);
let initial = acc
.display_name
.chars()
.next()
.or_else(|| acc.login.chars().next())
.unwrap_or(if ru { 'Я' } else { 'Y' })
.to_uppercase()
.to_string();
ctx.draw_text_ellipsis(
&initial,
TextStyle::bold(22.0, id_text_primary),
av_rect,
TextAlign::Center,
);
}
let name_y = card_rect.top() + 20.0 + 56.0 + 10.0;
ctx.draw_text_ellipsis(
&acc.display_name,
TextStyle::bold(20.0, pal.text_bright),
Rect::from_xywh(inner.left(), y, inner.width(), 26.0),
TextAlign::Left,
TextStyle::bold(16.0, id_text_primary),
Rect::from_center_size(Pos2::new(card_rect.center_x(), name_y + 11.0), Vec2::new(260.0, 22.0)),
TextAlign::Center,
);
y += 26.0;
let sub_y = name_y + 22.0 + 2.0;
let contact_str = acc
.default_email
.as_deref()
.filter(|s| !s.is_empty())
.unwrap_or(&acc.login);
ctx.draw_text_ellipsis(
&format!("@{}", acc.login),
TextStyle::regular(13.0, pal.text_secondary),
Rect::from_xywh(inner.left(), y, inner.width(), 18.0),
TextAlign::Left,
contact_str,
TextStyle::regular(13.0, id_text_secondary),
Rect::from_center_size(Pos2::new(card_rect.center_x(), sub_y + 9.0), Vec2::new(260.0, 18.0)),
TextAlign::Center,
);
y += 30.0;
} else {
let hx = card_rect.left() + 16.0;
let hw = card_w - 32.0;
let mut hy = card_rect.top() + 52.0;
let title = if ru { "Войдите в аккаунт" } else { "Log in" };
ctx.draw_text_ellipsis(
i18n.log_in(),
TextStyle::bold(22.0, pal.text_bright),
Rect::from_xywh(inner.left(), y, inner.width(), 28.0),
title,
TextStyle::bold(20.0, id_text_primary),
Rect::from_xywh(hx, hy, hw, 28.0),
TextAlign::Left,
);
y += 30.0;
hy += 34.0;
let subtitle = if ru {
"Чтобы сохранить свои закладки, пароли и карты"
} else {
"To save your bookmarks, passwords, and cards"
};
ctx.draw_text_wrapped(
i18n.login_subtitle(),
TextStyle::regular(13.0, pal.text_secondary),
Rect::from_xywh(inner.left(), y, inner.width(), 34.0),
subtitle,
TextStyle::regular(13.0, id_text_secondary),
Rect::from_xywh(hx, hy, hw, 36.0),
Some(2),
TextAlign::Left,
);
y += 40.0;
hy += 52.0;
let btn_r = Rect::from_xywh(inner.left(), y, inner.width(), 42.0);
let btn_r = Rect::from_xywh(hx, hy, hw, 44.0);
let btn_resp = ctx.interact(WidgetId::new("prof_login_btn"), btn_r);
let btn_bg = if btn_resp.hovered {
pal.text_primary
let btn_bg = if is_dark {
if btn_resp.hovered {
Color::rgb(0xE8, 0xE8, 0xF2)
} else {
pal.text_bright
Color::rgb(0xFA, 0xFA, 0xFF)
}
} else if btn_resp.hovered {
Color::rgb(0x3B, 0x3B, 0x47)
} else {
Color::rgb(0x29, 0x29, 0x33)
};
ctx.dl().push_rect(btn_r, 14.0, btn_bg);
let btn_fg = if is_dark {
Color::rgb(0x1F, 0x1F, 0x24)
} else {
Color::WHITE
};
ctx.dl().push_rect(btn_r, 12.0, btn_bg);
ctx.draw_text_ellipsis(
i18n.log_in(),
TextStyle::bold(15.0, pal.profile_bg),
if ru { "Войти" } else { "Log in" },
TextStyle::bold(15.0, btn_fg),
btn_r,
TextAlign::Center,
);
@ -752,242 +879,478 @@ fn render_profile_card_popup(
actions.push(AppAction::SetLoginModalOpen(true));
close_popup = true;
}
y += 52.0;
}
// Helper for 100% theme-aware Yandex ID card rows
let draw_profile_row = |ctx: &mut UiContext,
// Helper for exact Yandex ID v2.79.0 menu rows (`padding: 0 8px`, `radius: 12px`, `24px` icon @ `+12px`, text @ `+48px`)
let row_x = card_rect.left() + 8.0;
let row_w = card_w - 16.0;
let draw_id_row = |ctx: &mut UiContext,
id: &str,
y_pos: f32,
row_h: f32,
ic: Icon,
ic_tint: Color,
title: &str,
subtitle: Option<&str>,
has_chevron: bool,
active: bool|
active: bool,
right_plus_badge: Option<&str>|
-> (bool, bool, Rect) {
let h = if subtitle.is_some() { 50.0 } else { 40.0 };
let r = Rect::from_xywh(inner.left(), y_pos, inner.width(), h);
let r = Rect::from_xywh(row_x, y_pos, row_w, row_h);
let resp = ctx.interact(WidgetId::new(id), r);
if resp.hovered || active {
ctx.dl().push_rect(r, 12.0, pal.surface_hover);
ctx.dl().push_rect(r, 12.0, id_row_hover);
}
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
ctx.draw_icon(
ic,
Rect::from_center_size(Pos2::new(r.left() + 18.0, r.center_y()), Vec2::splat(20.0)),
pal.text_primary,
Rect::from_center_size(Pos2::new(r.left() + 24.0, r.center_y()), Vec2::splat(24.0)),
ic_tint,
);
let tx = r.left() + 42.0;
let tw = (r.right() - tx - if has_chevron { 28.0 } else { 8.0 }).max(40.0);
let tx = r.left() + 48.0;
let right_reserve = if right_plus_badge.is_some() {
68.0
} else if has_chevron {
32.0
} else {
12.0
};
let tw = (r.right() - tx - right_reserve).max(40.0);
if let Some(sub) = subtitle {
ctx.draw_text_ellipsis(
title,
TextStyle::medium(14.0, pal.text_primary),
Rect::from_xywh(tx, r.top() + 6.0, tw, 19.0),
TextStyle::medium(14.5, id_text_primary),
Rect::from_xywh(tx, r.top() + 8.0, tw, 20.0),
TextAlign::Left,
);
ctx.draw_text_ellipsis(
sub,
TextStyle::regular(12.0, pal.text_secondary),
Rect::from_xywh(tx, r.top() + 26.0, tw, 17.0),
TextStyle::regular(12.5, id_text_secondary),
Rect::from_xywh(tx, r.top() + 29.0, tw, 17.0),
TextAlign::Left,
);
} else {
ctx.draw_text_ellipsis(
title,
TextStyle::medium(14.0, pal.text_primary),
TextStyle::medium(14.5, id_text_primary),
Rect::from_xywh(tx, r.top(), tw, r.height()),
TextAlign::Left,
);
}
if has_chevron {
if let Some(badge_txt) = right_plus_badge {
let bw = (ctx.measure_text(badge_txt, TextStyle::bold(11.5, Color::WHITE), None).x
+ 18.0)
.max(46.0);
let br = Rect::from_xywh(r.right() - bw - 10.0, r.center_y() - 10.0, bw, 20.0);
ctx.dl().push_plus_gradient_rect(br, 10.0, 1.0);
ctx.draw_text_ellipsis(
badge_txt,
TextStyle::bold(11.5, Color::WHITE),
br,
TextAlign::Center,
);
} else if has_chevron {
ctx.draw_icon(
Icon::MenuArrowXxs,
Rect::from_center_size(Pos2::new(r.right() - 14.0, r.center_y()), Vec2::splat(20.0)),
pal.text_secondary,
Rect::from_center_size(Pos2::new(r.right() - 16.0, r.center_y()), Vec2::splat(20.0)),
id_text_secondary,
);
}
(resp.clicked, resp.hovered, r)
};
// Row 1: Yandex Plus
let plus_title = if has_plus {
if ru { "Яндекс Плюс" } else { "Yandex Plus" }
} else if ru {
"Подключить Яндекс Плюс"
let draw_separator = |ctx: &mut UiContext, y_pos: f32| {
ctx.dl().push_rect(
Rect::from_xywh(card_rect.left() + 16.0, y_pos + 6.0, card_w - 32.0, 1.0),
0.0,
id_separator,
);
};
// 3. Menu Group 1 (`r.Menu`)
// Row 1 — Plus (`54px`)
let (plus_title, plus_sub, plus_pill) = if has_plus {
(
if ru { "Плюс" } else { "Plus" },
if ru {
"Подписка активна"
} else {
"Subscription is active"
},
Some(if ru { "Плюс" } else { "Plus" }),
)
} else {
(
if ru {
"Подключить Плюс"
} else {
"Connect Yandex Plus"
};
let plus_sub = if ru {
"Все преимущества в одной подписке"
},
if ru {
"Все развлечения и выгода в одной подписке"
} else {
"All the fun and benefits in one subscription"
},
None,
)
};
if draw_profile_row(ctx, "prof_plus", y, Icon::Plus, plus_title, Some(plus_sub), false, false).0 {
let (c, h, _) = draw_id_row(
ctx,
"prof_plus",
y,
54.0,
Icon::ProfilePlusXxs,
Color::WHITE, // multi-stop gradient SVG
plus_title,
Some(plus_sub),
false,
false,
plus_pill,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::OpenUrl("https://plus.yandex.ru".into()));
close_popup = true;
}
y += 50.0;
y += 54.0;
// Row 2: Account management (dedicated `ProfileAccountXxs`)
if draw_profile_row(
// Row 2 — Account management (logged in)
if logged_in {
let (c, h, _) = draw_id_row(
ctx,
"prof_account",
y,
44.0,
Icon::ProfileAccountXxs,
i18n.account_management(),
id_text_primary,
if ru {
"Управление аккаунтом"
} else {
"Account management"
},
None,
false,
false,
)
.0
{
None,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::OpenUrl("https://id.yandex.ru".into()));
close_popup = true;
}
y += 40.0;
y += 44.0;
// Row 3: Settings (`SettingsXxs`)
if draw_profile_row(
// Row 3 — Settings (logged in)
let (c, h, _) = draw_id_row(
ctx,
"prof_settings",
y,
Icon::SettingsXxs,
i18n.settings(),
44.0,
Icon::ProfileSettingsXxs,
id_text_primary,
if ru { "Настройки" } else { "Settings" },
None,
false,
false,
)
.0
{
None,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::Navigate(Route::Settings));
close_popup = true;
}
y += 40.0;
y += 44.0;
}
// Row 4: Support chat (`ProfileSupportXxs`)
if draw_profile_row(
// Row 4 — Support chat (paper-plane)
let (c, h, _) = draw_id_row(
ctx,
"prof_support",
y,
44.0,
Icon::ProfileSupportXxs,
i18n.support_chat(),
id_text_primary,
if ru {
"Чат с поддержкой"
} else {
"Chat with support"
},
None,
false,
false,
)
.0
{
actions.push(AppAction::OpenUrl("https://yandex.ru/support/music/".into()));
None,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::OpenUrl(
"https://yandex.ru/support/plus/help/ru/?utm_source=music".into(),
));
close_popup = true;
}
y += 40.0;
y += 44.0;
// Row 5: Language (`ProfileGlobeXxs`)
if draw_profile_row(
// Row 5 — Language (opens Yandex ID Language Popover!)
let (lang_clicked, lang_hovered, lang_r) = draw_id_row(
ctx,
"prof_lang",
y,
44.0,
Icon::ProfileGlobeXxs,
i18n.language_name(),
id_text_primary,
if ru { "Русский" } else { "English" },
None,
false,
false,
)
.0
{
actions.push(AppAction::ToggleLanguage);
close_popup = true;
true,
shell.sidebar_lang_open,
None,
);
lang_row_rect = lang_r;
if lang_clicked {
shell.sidebar_lang_open = !shell.sidebar_lang_open;
if shell.sidebar_lang_open {
shell.sidebar_appearance_open = false;
}
y += 40.0;
} else if lang_hovered {
shell.sidebar_lang_open = true;
shell.sidebar_appearance_open = false;
}
y += 44.0;
// Divider
ctx.dl()
.push_rect(Rect::from_xywh(inner.left(), y + 6.0, inner.width(), 1.0), 0.0, pal.border_control);
y += 13.0;
// 4. Hairline Separator 1
draw_separator(ctx, y);
y += sep_h;
// Row 6: Appearance (`ProfileAppearanceXxs`) -> opens 3-way Appearance submenu!
let (app_clicked, app_hovered, app_rect) = draw_profile_row(
// 5. Menu Group 2 (`r.Submenu`) — Appearance (dynamic icon matching current theme!)
let theme_row_icon = match app.config.theme {
ThemeMode::Light => Icon::ThemeLightXxs,
ThemeMode::Dark => Icon::ThemeDarkXxs,
ThemeMode::System => Icon::ThemeSystemXxs,
};
let (app_clicked, app_hovered, app_r) = draw_id_row(
ctx,
"prof_appearance",
y,
Icon::ProfileAppearanceXxs,
i18n.appearance(),
44.0,
theme_row_icon,
id_text_primary,
if ru { "Внешний вид" } else { "Appearance" },
None,
true,
shell.sidebar_appearance_open,
None,
);
appearance_row_rect = app_rect;
appearance_row_rect = app_r;
if app_clicked {
shell.sidebar_appearance_open = !shell.sidebar_appearance_open;
if shell.sidebar_appearance_open {
shell.sidebar_lang_open = false;
}
} else if app_hovered {
shell.sidebar_appearance_open = true;
shell.sidebar_lang_open = false;
}
y += 40.0;
y += 44.0;
// Row 7: Sign out (`ProfileLogoutXxs`) when logged in
if logged_in
&& draw_profile_row(
// 6. Hairline Separator 2 + Account Actions (when logged in)
if logged_in {
draw_separator(ctx, y);
y += sep_h;
// Row 7 — Add account
let (c, h, _) = draw_id_row(
ctx,
"prof_logout",
"prof_add_account",
y,
Icon::ProfileLogoutXxs,
i18n.sign_out(),
44.0,
Icon::ProfileAddAccountXxs,
id_text_primary,
if ru {
"Добавить аккаунт"
} else {
"Add account"
},
None,
false,
false,
)
.0
{
None,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::SetLoginModalOpen(true));
close_popup = true;
}
y += 44.0;
// Row 8 — Sign out
let (c, h, _) = draw_id_row(
ctx,
"prof_logout",
y,
44.0,
Icon::ProfileLogoutXxs,
id_text_primary,
if ru { "Выйти" } else { "Sign out" },
None,
false,
false,
None,
);
if h {
shell.sidebar_lang_open = false;
shell.sidebar_appearance_open = false;
}
if c {
actions.push(AppAction::Logout);
close_popup = true;
}
}
// Appearance Submenu (`Как в системе` / `Тёмная` / `Светлая` + active `CheckXxs`!)
let mut submenu_rect = Rect::ZERO;
// 7A. Yandex ID Language Popover (`210px`, `radius: 16px`, `40px` items: `ru Русский` / `en English`)
let mut lang_sub_rect = Rect::ZERO;
if shell.sidebar_lang_open {
let sub_w = 210.0;
let sub_h = 40.0 * 2.0 + 16.0;
let sub_x = (card_rect.right() + 8.0).min((screen.right() - sub_w - 8.0).max(8.0));
let sub_y = (lang_row_rect.top() - 8.0)
.clamp(40.0, (screen.bottom() - sub_h - 12.0).max(40.0));
lang_sub_rect = Rect::from_xywh(sub_x, sub_y, sub_w, sub_h);
ctx.register_blocker(lang_sub_rect);
ctx.dl()
.push_shadow(lang_sub_rect, 16.0, 24.0, 0.0, Vec2::new(0.0, 6.0), pal.shadow_modal);
ctx.dl()
.push_rect_bordered(lang_sub_rect, 16.0, popover_bg, 1.0, popover_border);
let sub_inner = lang_sub_rect.shrink(8.0);
let lang_opts = [
(Language::Ru, "ru", "Русский", "lang_opt_ru"),
(Language::En, "en", "English", "lang_opt_en"),
];
for (idx, (lang, code, lbl, wid)) in lang_opts.into_iter().enumerate() {
let is_cur = app.config.language == lang;
let ir = Rect::from_xywh(sub_inner.x, sub_inner.y + idx as f32 * 40.0, sub_inner.w, 40.0);
let r = ctx.interact(WidgetId::new(wid), ir);
if r.hovered {
ctx.dl().push_rect(ir, 12.0, id_row_hover);
ctx.set_cursor(CursorKind::Pointer);
}
ctx.draw_text_ellipsis(
code,
TextStyle::bold(13.0, id_text_secondary),
Rect::from_xywh(ir.left() + 12.0, ir.top(), 24.0, ir.height()),
TextAlign::Left,
);
ctx.draw_text_ellipsis(
lbl,
TextStyle::medium(14.0, id_text_primary),
Rect::from_xywh(ir.left() + 42.0, ir.top(), (ir.width() - 72.0).max(40.0), ir.height()),
TextAlign::Left,
);
if is_cur {
ctx.draw_icon(
Icon::CheckXxs,
Rect::from_center_size(Pos2::new(ir.right() - 16.0, ir.center_y()), Vec2::splat(20.0)),
id_text_primary,
);
}
if r.clicked {
actions.push(AppAction::SetLanguage(lang));
shell.sidebar_lang_open = false;
}
}
}
// 7B. Yandex ID Appearance Popover (`224px`, `radius: 16px`, `40px` items in exact official order!)
let mut app_sub_rect = Rect::ZERO;
if shell.sidebar_appearance_open {
let sub_w = 220.0;
let sub_h = 36.0 * 3.0 + 16.0;
let sub_w = 224.0;
let sub_h = 40.0 * 3.0 + 16.0;
let sub_x = (card_rect.right() + 8.0).min((screen.right() - sub_w - 8.0).max(8.0));
let sub_y = (appearance_row_rect.top() - 8.0)
.clamp(40.0, (screen.bottom() - sub_h - 12.0).max(40.0));
submenu_rect = Rect::from_xywh(sub_x, sub_y, sub_w, sub_h);
app_sub_rect = Rect::from_xywh(sub_x, sub_y, sub_w, sub_h);
ctx.register_blocker(app_sub_rect);
ctx.dl()
.push_shadow(app_sub_rect, 16.0, 24.0, 0.0, Vec2::new(0.0, 6.0), pal.shadow_modal);
ctx.dl()
.push_rect_bordered(app_sub_rect, 16.0, popover_bg, 1.0, popover_border);
let sub_inner = ym_menu_frame(ctx, pal, submenu_rect);
let sub_inner = app_sub_rect.shrink(8.0);
let theme_opts = [
(ThemeMode::System, Icon::ThemeSystemXxs, i18n.theme_system(), "theme_opt_sys"),
(ThemeMode::Dark, Icon::ThemeDarkXxs, i18n.theme_dark(), "theme_opt_dark"),
(ThemeMode::Light, Icon::ThemeLightXxs, i18n.theme_light(), "theme_opt_light"),
(
ThemeMode::Light,
Icon::ThemeLightXxs,
if ru { "Всегда светлый" } else { "Always light" },
"theme_opt_light",
),
(
ThemeMode::Dark,
Icon::ThemeDarkXxs,
if ru { "Всегда тёмный" } else { "Always dark" },
"theme_opt_dark",
),
(
ThemeMode::System,
Icon::ThemeSystemXxs,
if ru { "Как в системе" } else { "System settings" },
"theme_opt_sys",
),
];
for (idx, (mode, ic, lbl, wid)) in theme_opts.into_iter().enumerate() {
let is_cur = app.config.theme == mode;
let ir = Rect::from_xywh(sub_inner.x, sub_inner.y + idx as f32 * 36.0, sub_inner.w, 36.0);
if ym_menu_item_ex(
ctx,
pal,
WidgetId::new(wid),
ir,
let ir = Rect::from_xywh(sub_inner.x, sub_inner.y + idx as f32 * 40.0, sub_inner.w, 40.0);
let r = ctx.interact(WidgetId::new(wid), ir);
if r.hovered {
ctx.dl().push_rect(ir, 12.0, id_row_hover);
ctx.set_cursor(CursorKind::Pointer);
}
ctx.draw_icon(
ic,
Rect::from_center_size(Pos2::new(ir.left() + 20.0, ir.center_y()), Vec2::splat(20.0)),
id_text_primary,
);
ctx.draw_text_ellipsis(
lbl,
is_cur,
is_cur,
false,
false,
)
.clicked
{
TextStyle::medium(14.0, id_text_primary),
Rect::from_xywh(ir.left() + 42.0, ir.top(), (ir.width() - 72.0).max(40.0), ir.height()),
TextAlign::Left,
);
if is_cur {
ctx.draw_icon(
Icon::CheckXxs,
Rect::from_center_size(Pos2::new(ir.right() - 16.0, ir.center_y()), Vec2::splat(20.0)),
id_text_primary,
);
}
if r.clicked {
actions.push(AppAction::SetTheme(mode));
shell.sidebar_appearance_open = false;
}
}
}
// Click outside profile card + submenu + profile trigger button closes popup
// Click outside profile card + open sub-popover + profile trigger button closes everything cleanly
let mut keep_rects = vec![card_rect, profile_hit];
if !submenu_rect.is_empty() {
keep_rects.push(submenu_rect);
if !lang_sub_rect.is_empty() {
keep_rects.push(lang_sub_rect);
}
if !app_sub_rect.is_empty() {
keep_rects.push(app_sub_rect);
}
if ctx.input.clicked_outside_any(&keep_rects) {
close_popup = true;
@ -997,5 +1360,6 @@ fn render_profile_card_popup(
if close_popup {
shell.sidebar_profile_open = false;
shell.sidebar_appearance_open = false;
shell.sidebar_lang_open = false;
}
}

View file

@ -398,6 +398,7 @@ fn build_reference_matched_shell(
uid: 42,
login: "marwy".into(),
display_name: "Marwy".into(),
default_email: None,
has_plus: true,
avatar_uri: Some("test.local/avatar_marwy/%%".into()),
});

View file

@ -105,6 +105,7 @@ fn make_base_shell(
uid: 1,
login: "Marwy".into(),
display_name: "Marwy".into(),
default_email: Some("marwy@yandex.ru".into()),
has_plus: true,
avatar_uri: None,
});
@ -1673,3 +1674,188 @@ fn test_ext_15_opengl33_strict_shaders_and_renderer_backend() {
);
}
}
#[test]
fn test_ext_16_yandex_id_popup_and_words_card_visual_parity() {
use yandex_music_rs::api::models::{WordsCard, WordsCardSource};
use yandex_music_rs::engine::types::Pos2;
let rt = tokio::runtime::Runtime::new().unwrap();
let mut vk = HeadlessVulkanRenderer::new(NATIVE_W, NATIVE_H).expect("Vulkan init failed");
let out_dir = output_dir();
let _ = std::fs::create_dir_all(&out_dir);
// 1. Dark Theme Yandex ID v2.79.0 Account Popup + Appearance Popover (`dark_profile_popup.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::LikedTracks,
ThemeMode::Dark,
Language::Ru,
0.0,
);
shell.shell.sidebar_profile_open = true;
shell.shell.sidebar_appearance_open = true;
let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
for f in 1..3 {
img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.016);
}
let _ = img.save(out_dir.join("dark_profile_popup.png"));
// Verify `#1F1F24` dark Yandex ID card surface inside x=32..320, y=240..660
let mut card_bg_px = 0usize;
let mut bright_text_px = 0usize;
for y in 240..660 {
for x in 32..320 {
let [r, g, b] = img.get_pixel(x, y).0;
if (r as i32 - 0x1F).abs() <= 6
&& (g as i32 - 0x1F).abs() <= 6
&& (b as i32 - 0x24).abs() <= 6
{
card_bg_px += 1;
} else if r >= 220 && g >= 220 && b >= 225 {
bright_text_px += 1;
}
}
}
assert!(
card_bg_px > 40_000,
"[dark_profile_popup] Expected Yandex ID #1F1F24 dark surface (got {} px)",
card_bg_px
);
assert!(
bright_text_px > 1_200,
"[dark_profile_popup] Expected high-contrast #FAFAFF text/icons (got {} px)",
bright_text_px
);
// Verify Appearance submenu popover rendered to the right of the card (x=345..555)
let mut sub_bg_px = 0usize;
for y in 420..660 {
for x in 348..555 {
let [r, g, b] = img.get_pixel(x, y).0;
if (r as i32 - 0x2D).abs() <= 8
&& (g as i32 - 0x2D).abs() <= 8
&& (b as i32 - 0x34).abs() <= 8
{
sub_bg_px += 1;
}
}
}
assert!(
sub_bg_px > 10_000,
"[dark_profile_popup] Expected Yandex ID #2D2D34 Appearance popover (got {} px)",
sub_bg_px
);
}
// 2. My Vibe official 5.129.0 `WordsCard` + `WordsCardPopoverDesktop` (`my_vibe_words_popover.png`)
{
// Static guard: fake AI Vibe-settings string MUST be completely gone from `src/views/my_vibe.rs`
let mv_src = std::fs::read_to_string(
Path::new(env!("CARGO_MANIFEST_DIR")).join("src/views/my_vibe.rs"),
)
.expect("read src/views/my_vibe.rs");
assert!(
!mv_src.contains("Мою волну по настроению и характеру"),
"Fake AI Vibe-settings phrase must be removed from WordsCard in src/views/my_vibe.rs!"
);
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::MyVibe,
ThemeMode::Dark,
Language::Ru,
108.0,
);
shell.app.words_cards.insert(
"t_1".into(),
WordsCard {
id: "wc_test_1".into(),
track_id: "t_1".into(),
text: "Трек вдохновлён бразильским фонком и энергичными рейвами 2000-х".into(),
tags: vec!["FACT".into()],
action: None,
actions: vec![WordsCardSource {
title: "Подробнее об артисте".into(),
url: "https://music.yandex.ru".into(),
favicon_url: None,
}],
big_card_ids: Vec::new(),
feedback_state: None,
},
);
// Warm up WordsCard layout (renders State B around cx~943, ai_y~732)
let before = render_single_frame(&mut vk, &mut shell, 0.0);
let click_pos = Pos2::new(943.0, 732.0);
// Simulate genuine left-click press + release on WordsCard to toggle WordsCardPopoverDesktop
shell.ui.input.pointer_pos = Some(click_pos);
shell.ui.input.left_down = true;
shell.ui.input.left_pressed = true;
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
shell.ui.input.left_down = false;
shell.ui.input.left_released = true;
let _ = render_single_frame(&mut vk, &mut shell, 0.032);
let after = render_single_frame(&mut vk, &mut shell, 0.048);
let _ = after.save(out_dir.join("my_vibe_words_popover.png"));
// Verify WordsCardPopoverDesktop actually appeared above WordsCard (y=500..700, x=810..1075)
let popover_delta = region_mean_abs_diff(&before, &after, 810, 500, 1075, 700);
assert!(
popover_delta > 4.0,
"[my_vibe_words_popover] Clicking WordsCard did not open WordsCardPopoverDesktop (delta={:.2} RGB)",
popover_delta
);
assert!(
!shell.app.vibe_modal_open,
"[my_vibe_words_popover] Clicking WordsCard MUST NOT open fake Vibe settings modal!"
);
}
// 3. Official 1-to-1 `VibeResetButton` unified pill + `0.1.0` version badge (`my_vibe_context_pill.png`)
{
use yandex_music_rs::app::APP_VERSION;
assert_eq!(APP_VERSION, "0.1.0", "APP_VERSION must match Cargo.toml 0.1.0");
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::MyVibe,
ThemeMode::Dark,
Language::En,
12.0,
);
if let Some(tr) = shell.app.queue.get_mut(0) {
tr.derived_average_hex = Some("#F56E00".into());
}
shell.app.is_vibe_active = false;
shell.app.context_name = "My Favorites".into();
shell.app.context_key = "likes".into();
shell.app.set_vibe_playback_for_test(true, 0.45, 0.35);
let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
for f in 1..4 {
img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.2);
}
let _ = img.save(out_dir.join("my_vibe_context_pill.png"));
// Verify bright electric yellow pixels (#FFFF00) inside top-center VibeResetButton pill (y=32..80, x=830..1060)
let mut pill_yellow_px = 0usize;
for y in 32..80 {
for x in 830..1060 {
if is_yandex_yellow(img.get_pixel(x, y).0) {
pill_yellow_px += 1;
}
}
}
assert!(
pill_yellow_px >= 400,
"[my_vibe_context_pill] Expected electric yellow text + filled yellow close circle inside unified VibeResetButton pill, found {} yellow px",
pill_yellow_px
);
}
}