MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / FieldValue

Function FieldValue

apps/start/src/components/ui/key-value-grid.tsx:148–238  ·  view source on GitHub ↗
({
  name,
  value,
  event,
}: {
  name: string;
  value: any;
  event?: IServiceEvent;
})

Source from the content-addressed store, hash-verified

146}
147
148export function FieldValue({
149 name,
150 value,
151 event,
152}: {
153 name: string;
154 value: any;
155 event?: IServiceEvent;
156}) {
157 if (!value) {
158 return null;
159 }
160
161 if (value instanceof Date) {
162 return isToday(value) ? formatTime(value) : formatDateTime(value);
163 }
164
165 if (event) {
166 switch (name) {
167 case 'osVersion':
168 return (
169 <div className="row gap-2 items-center">
170 <SerieIcon name={event.os} />
171 <span>{value}</span>
172 </div>
173 );
174 case 'browserVersion':
175 return (
176 <div className="row gap-2 items-center">
177 <SerieIcon name={event.browser} />
178 <span>{value}</span>
179 </div>
180 );
181 case 'city':
182 return (
183 <div className="row gap-2 items-center">
184 <SerieIcon name={event.country} />
185 <span>{value}</span>
186 </div>
187 );
188 case 'region':
189 return (
190 <div className="row gap-2 items-center">
191 <SerieIcon name={event.country} />
192 <span>{value}</span>
193 </div>
194 );
195 case 'properties':
196 return JSON.stringify(value);
197 case 'country':
198 return (
199 <div className="row gap-2 items-center">
200 <SerieIcon name={value} />
201 <span>{countries[value as keyof typeof countries] ?? value}</span>
202 </div>
203 );
204 case 'browser':
205 case 'os':

Callers

nothing calls this directly

Calls 5

formatTimeFunction · 0.90
formatDateTimeFunction · 0.90
fancyMinutesFunction · 0.90
isTodayFunction · 0.85
stringifyMethod · 0.45

Tested by

no test coverage detected