mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Revert "Merge pull request #62 from project-error/feature/show-app-name-on-hover"
This reverts commit 5f7875182c.
This commit is contained in:
1 parent
5f7875182c
commit
d6a8c45d52
3 files changed
+16
-33
No files matched your search
@@ -39,16 +39,6 @@ import { SelloutApp } from '../../../apps/sellout/components/SelloutApp';
|
|||||||
import { NotesApp } from '../../../apps/notes/NotesApp';
|
import { NotesApp } from '../../../apps/notes/NotesApp';
|
||||||
import CameraApp from '../../../apps/camera/components/CameraApp';
|
import CameraApp from '../../../apps/camera/components/CameraApp';
|
||||||
|
|
||||||
export interface AppConfiguration {
|
|
||||||
id: string;
|
|
||||||
nameLocale: string;
|
|
||||||
icon: JSX.Element;
|
|
||||||
backgroundColor: string;
|
|
||||||
color: string;
|
|
||||||
path: string;
|
|
||||||
Route: () => JSX.Element;
|
|
||||||
}
|
|
||||||
|
|
||||||
const appsState = atom({
|
const appsState = atom({
|
||||||
key: 'apps',
|
key: 'apps',
|
||||||
default: {
|
default: {
|
||||||
@@ -158,7 +148,7 @@ const appsState = atom({
|
|||||||
|
|
||||||
export const useApps = () => {
|
export const useApps = () => {
|
||||||
const [apps, setApps] = useConfig(appsState);
|
const [apps, setApps] = useConfig(appsState);
|
||||||
const allApps: AppConfiguration[] = [...apps.preinstalled];
|
const allApps = [...apps.preinstalled];
|
||||||
|
|
||||||
const getApp = (id) => allApps.find((a) => a.id === id) || null;
|
const getApp = (id) => allApps.find((a) => a.id === id) || null;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import Avatar from '@material-ui/core/Avatar';
|
|||||||
import { green } from '@material-ui/core/colors';
|
import { green } from '@material-ui/core/colors';
|
||||||
import { Button } from '@material-ui/core';
|
import { Button } from '@material-ui/core';
|
||||||
import Nui from '../../os/nui-events/utils/Nui';
|
import Nui from '../../os/nui-events/utils/Nui';
|
||||||
import { AppConfiguration } from '../../os/apps/hooks/useApps';
|
|
||||||
|
|
||||||
interface IStyles {
|
interface IStyles {
|
||||||
root: any;
|
root: any;
|
||||||
@@ -30,7 +29,7 @@ const useStyles = makeStyles(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
export const AppIcon = ({ id, icon, backgroundColor, color }: AppConfiguration) => {
|
export const AppIcon = ({ id, name, icon, backgroundColor, color }) => {
|
||||||
const classes = useStyles({
|
const classes = useStyles({
|
||||||
backgroundColor: backgroundColor || green[50],
|
backgroundColor: backgroundColor || green[50],
|
||||||
color: color || green[400],
|
color: color || green[400],
|
||||||
@@ -43,7 +42,7 @@ export const AppIcon = ({ id, icon, backgroundColor, color }: AppConfiguration)
|
|||||||
return (
|
return (
|
||||||
<Button onClick={openAppCallback} className={classes.root}>
|
<Button onClick={openAppCallback} className={classes.root}>
|
||||||
<Avatar className={classes.avatar}>
|
<Avatar className={classes.avatar}>
|
||||||
{icon}
|
{icon || name[0].toUpperCase()}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { AppIcon } from './AppIcon';
|
import { AppIcon } from './AppIcon';
|
||||||
import { Grid, makeStyles, Tooltip } from '@material-ui/core';
|
import { Grid, makeStyles } from '@material-ui/core';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { useKeyboard } from '../../os/keyboard/hooks/useKeyboard';
|
import { useKeyboard } from '../../os/keyboard/hooks/useKeyboard';
|
||||||
import { AppConfiguration } from '../../os/apps/hooks/useApps';
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
@@ -15,18 +13,12 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
width: '20%',
|
width: '20%',
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
bottom: -12,
|
bottom: -8,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
interface IProps {
|
export const GridMenu = ({ items, Component = AppIcon }) => {
|
||||||
items: AppConfiguration[];
|
|
||||||
Component: (...AppConfiguration) => JSX.Element;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GridMenu = ({ items, Component = AppIcon }: IProps) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const setKey = useKeyboard();
|
const setKey = useKeyboard();
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
@@ -43,13 +35,15 @@ export const GridMenu = ({ items, Component = AppIcon }: IProps) => {
|
|||||||
{items &&
|
{items &&
|
||||||
items.length &&
|
items.length &&
|
||||||
items.map((item) => (
|
items.map((item) => (
|
||||||
<Tooltip
|
// <Tooltip
|
||||||
key={item.id}
|
// title={item.id}
|
||||||
title={t(item.nameLocale)}
|
// placement='top'
|
||||||
placement="top-start"
|
// arrow
|
||||||
classes={{ tooltip: classes.tooltip }}
|
// classes={{ tooltip: classes.tooltip }}
|
||||||
arrow
|
// PopperProps={{
|
||||||
>
|
// anchorEl={}
|
||||||
|
// }}
|
||||||
|
// >
|
||||||
<Grid
|
<Grid
|
||||||
key={item.id}
|
key={item.id}
|
||||||
item
|
item
|
||||||
@@ -59,7 +53,7 @@ export const GridMenu = ({ items, Component = AppIcon }: IProps) => {
|
|||||||
>
|
>
|
||||||
<Component {...item} />
|
<Component {...item} />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Tooltip>
|
// </Tooltip>
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in new issue
Block a user