Ezmary commited on
Commit
b242845
·
verified ·
1 Parent(s): 67a1642

Update src/App.tsx

Browse files
Files changed (1) hide show
  1. src/App.tsx +11 -22
src/App.tsx CHANGED
@@ -1,16 +1,4 @@
1
- /**
2
- Copyright 2024 Google LLC
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- */
13
-
14
  import React, { useEffect, useRef, useState } from "react";
15
  import './App.scss';
16
  import { LiveAPIProvider, useLiveAPIContext } from "./contexts/LiveAPIContext";
@@ -104,6 +92,7 @@ const initialAppConfig: LiveConfig = {
104
  },
105
  };
106
 
 
107
  const SvgHumanIcon = () => (
108
  <svg width="100%" height="100%" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
109
  <path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
@@ -111,16 +100,17 @@ const SvgHumanIcon = () => (
111
  </svg>
112
  );
113
 
 
114
  const SvgReferenceMicrophoneIcon = () => (
115
- // SVG میکروفون شما با transform="scale(0.55)" بود. برای بزرگتر دیده شدن در دکمه، scale را بیشتر می‌کنیم یا viewBox را تنظیم می‌کنیم.
116
- // اینجا scale را به 0.65 یا 0.7 تغییر می‌دهیم تا بزرگتر شود.
117
- <svg width="100%" height="100%" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg" transform="scale(0.7)" preserveAspectRatio="xMidYMid meet">
118
  <path opacity="0.4" d="M49.9479 27.1824C49.0803 27.1824 48.3907 27.872 48.3907 28.7396V32.2544C48.3907 40.1293 41.984 46.5361 34.109 46.5361C26.234 46.5361 19.8273 40.1293 19.8273 32.2544V28.7173C19.8273 27.8497 19.1377 27.1601 18.2701 27.1601C17.4025 27.1601 16.7129 27.8497 16.7129 28.7173V32.2321C16.7129 41.2861 23.6758 48.7384 32.5518 49.5393V54.2776C32.5518 55.1452 33.2414 55.8348 34.109 55.8348C34.9766 55.8348 35.6662 55.1452 35.6662 54.2776V49.5393C44.52 48.7607 51.5051 41.2861 51.5051 32.2321V28.7173C51.4829 27.872 50.7933 27.1824 49.9479 27.1824Z" fill="#BE123C"/>
119
  <path d="M34.1099 11.3434C28.682 11.3434 24.2773 15.7481 24.2773 21.176V32.5658C24.2773 37.9938 28.682 42.3984 34.1099 42.3984C39.5379 42.3984 43.9425 37.9938 43.9425 32.5658V21.176C43.9425 15.7481 39.5379 11.3434 34.1099 11.3434ZM37.0241 26.8042C36.8684 27.3826 36.3567 27.7608 35.7784 27.7608C35.6671 27.7608 35.5559 27.7385 35.4447 27.7163C34.5771 27.4716 33.665 27.4716 32.7974 27.7163C32.0856 27.9165 31.396 27.4938 31.218 26.8042C31.0178 26.1146 31.4404 25.4027 32.1301 25.2247C33.4426 24.8688 34.8218 24.8688 36.1343 25.2247C36.8017 25.4027 37.2021 26.1146 37.0241 26.8042ZM38.2031 22.4885C38.0029 23.0224 37.5135 23.3339 36.9796 23.3339C36.8239 23.3339 36.6904 23.3116 36.5347 23.2671C34.9775 22.6887 33.2423 22.6887 31.6852 23.2671C31.0178 23.5118 30.2614 23.1559 30.0167 22.4885C29.772 21.8212 30.128 21.0648 30.7953 20.8423C32.9309 20.0637 35.289 20.0637 37.4245 20.8423C38.0919 21.087 38.4478 21.8212 38.2031 22.4885Z" fill="#BE123C"/>
120
  </svg>
121
  );
122
 
123
-
 
124
  const AppInternalLogic: React.FC<{
125
  isMicActive: boolean;
126
  isCamActive: boolean;
@@ -153,9 +143,8 @@ const AppInternalLogic: React.FC<{
153
  }, [isMicActive, isCamActive, connected, disconnect]);
154
 
155
  return (
156
- // استفاده از کلاس app-container برای کنترل ارتفاع کلی
157
- <div className="app-container w-full flex flex-col items-center justify-center text-foreground antialiased">
158
- <div className="main-wrapper max-w-3xl w-full flex flex-col items-center h-full relative"> {/* حذف justify-center برای کنترل بهتر توسط flex-grow */}
159
  <div className="header-controls">
160
  <div id="notification-trigger-container">
161
  <button
@@ -197,8 +186,7 @@ const AppInternalLogic: React.FC<{
197
  </div>
198
  </div>
199
 
200
- {/* media-area باید flex-grow داشته باشد تا فضای باقی‌مانده را پر کند */}
201
- <div className="media-area w-full flex flex-col items-center justify-center relative">
202
  <video
203
  id="video-feed"
204
  ref={videoRef}
@@ -308,6 +296,7 @@ function App() {
308
 
309
  const size = isMini ? 80 : 200;
310
  const iconDisplaySize = isMini ? 35 : 70;
 
311
  const iconInset = (size - iconDisplaySize) / 2;
312
 
313
  const insetBase = {
 
1
+ // ... (لایسنس، ایمپورت‌های اولیه، myCustomInstruction, initialAppConfig بدون تغییر) ...
 
 
 
 
 
 
 
 
 
 
 
 
2
  import React, { useEffect, useRef, useState } from "react";
3
  import './App.scss';
4
  import { LiveAPIProvider, useLiveAPIContext } from "./contexts/LiveAPIContext";
 
92
  },
93
  };
94
 
95
+
96
  const SvgHumanIcon = () => (
97
  <svg width="100%" height="100%" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
98
  <path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="currentColor" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/>
 
100
  </svg>
101
  );
102
 
103
+ // SVG آیکون میکروفون از HTML مرجع شما - transform scale را موقتا حذف می‌کنیم یا به 1 تغییر می‌دهیم تا CSS کنترل کند
104
  const SvgReferenceMicrophoneIcon = () => (
105
+ // <svg width="38" height="38" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg" transform="scale(0.55)"> // قبلی
106
+ <svg className="reference-mic-svg" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg"> {/* کلاس اضافه شده */}
 
107
  <path opacity="0.4" d="M49.9479 27.1824C49.0803 27.1824 48.3907 27.872 48.3907 28.7396V32.2544C48.3907 40.1293 41.984 46.5361 34.109 46.5361C26.234 46.5361 19.8273 40.1293 19.8273 32.2544V28.7173C19.8273 27.8497 19.1377 27.1601 18.2701 27.1601C17.4025 27.1601 16.7129 27.8497 16.7129 28.7173V32.2321C16.7129 41.2861 23.6758 48.7384 32.5518 49.5393V54.2776C32.5518 55.1452 33.2414 55.8348 34.109 55.8348C34.9766 55.8348 35.6662 55.1452 35.6662 54.2776V49.5393C44.52 48.7607 51.5051 41.2861 51.5051 32.2321V28.7173C51.4829 27.872 50.7933 27.1824 49.9479 27.1824Z" fill="#BE123C"/>
108
  <path d="M34.1099 11.3434C28.682 11.3434 24.2773 15.7481 24.2773 21.176V32.5658C24.2773 37.9938 28.682 42.3984 34.1099 42.3984C39.5379 42.3984 43.9425 37.9938 43.9425 32.5658V21.176C43.9425 15.7481 39.5379 11.3434 34.1099 11.3434ZM37.0241 26.8042C36.8684 27.3826 36.3567 27.7608 35.7784 27.7608C35.6671 27.7608 35.5559 27.7385 35.4447 27.7163C34.5771 27.4716 33.665 27.4716 32.7974 27.7163C32.0856 27.9165 31.396 27.4938 31.218 26.8042C31.0178 26.1146 31.4404 25.4027 32.1301 25.2247C33.4426 24.8688 34.8218 24.8688 36.1343 25.2247C36.8017 25.4027 37.2021 26.1146 37.0241 26.8042ZM38.2031 22.4885C38.0029 23.0224 37.5135 23.3339 36.9796 23.3339C36.8239 23.3339 36.6904 23.3116 36.5347 23.2671C34.9775 22.6887 33.2423 22.6887 31.6852 23.2671C31.0178 23.5118 30.2614 23.1559 30.0167 22.4885C29.772 21.8212 30.128 21.0648 30.7953 20.8423C32.9309 20.0637 35.289 20.0637 37.4245 20.8423C38.0919 21.087 38.4478 21.8212 38.2031 22.4885Z" fill="#BE123C"/>
109
  </svg>
110
  );
111
 
112
+ // ... (AppInternalLogic, logoColorConfig, تابع App و createLogoFunction بدون تغییر نسبت به پاسخ قبلی) ...
113
+ // (مطمئن شوید که createLogoFunction تمام حلقه‌های انیمیشن را به درستی با insetهای محاسبه‌شده رندر می‌کند)
114
  const AppInternalLogic: React.FC<{
115
  isMicActive: boolean;
116
  isCamActive: boolean;
 
143
  }, [isMicActive, isCamActive, connected, disconnect]);
144
 
145
  return (
146
+ <div className="w-full flex flex-col items-center justify-center min-h-screen text-foreground antialiased">
147
+ <div className="main-wrapper max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
 
148
  <div className="header-controls">
149
  <div id="notification-trigger-container">
150
  <button
 
186
  </div>
187
  </div>
188
 
189
+ <div className="media-area w-full flex flex-col items-center justify-center flex-grow relative">
 
190
  <video
191
  id="video-feed"
192
  ref={videoRef}
 
296
 
297
  const size = isMini ? 80 : 200;
298
  const iconDisplaySize = isMini ? 35 : 70;
299
+
300
  const iconInset = (size - iconDisplaySize) / 2;
301
 
302
  const insetBase = {