go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/src/components/top_bar/user_actions/user_actions.tsx (about)

     1  // Copyright 2022 The LUCI Authors.
     2  //
     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  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  import {
    16    Link as RouterLink,
    17  } from 'react-router-dom';
    18  
    19  import HelpIcon from '@mui/icons-material/Help';
    20  import FeedbackIcon from '@mui/icons-material/Feedback';
    21  import Box from '@mui/material/Box';
    22  import IconButton from '@mui/material/IconButton';
    23  import Tooltip from '@mui/material/Tooltip';
    24  import LoginButton from '@/components/top_bar/user_actions/login_button/login_button';
    25  import UserProfileButton from '@/components/top_bar/user_actions/user_profile_button/user_profile_button';
    26  
    27  
    28  const UserActions = () => {
    29    return (
    30      <Box sx={{ flexGrow: 0, display: 'flex', alignItems: 'center' }}>
    31        <Tooltip title="Help">
    32          <IconButton
    33            component={RouterLink}
    34            to="/help"
    35            sx={{ color: 'white' }}>
    36            <HelpIcon />
    37          </IconButton>
    38        </Tooltip>
    39        <Tooltip title="Send feedback">
    40          <IconButton
    41            href="https://goto.google.com/luci-analysis-bug"
    42            target="_blank"
    43            sx={{ color: 'white' }}>
    44            <FeedbackIcon />
    45          </IconButton>
    46        </Tooltip>
    47        {
    48          window.isAnonymous ?
    49          (
    50            <LoginButton />
    51          ) :
    52          (
    53            <UserProfileButton />
    54          )
    55        }
    56      </Box>
    57    );
    58  };
    59  
    60  export default UserActions;