Skip to content

Commit

Permalink
branding update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavya Kala committed Feb 23, 2024
1 parent 6532edc commit 8f47a1a
Show file tree
Hide file tree
Showing 27 changed files with 694 additions and 834 deletions.
Binary file modified app/theme/brave/win/placeholder.ico
Binary file not shown.
Binary file modified app/theme/default_100_percent/brave/linux/product_logo_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/theme/default_100_percent/brave/linux/product_logo_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/theme/default_200_percent/brave/product_logo_name_22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/theme/default_200_percent/brave/product_logo_name_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/theme/default_200_percent/brave/product_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
128 changes: 64 additions & 64 deletions build/commands/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,48 +540,48 @@ const util = {
}
}

// if (config.targetOS === 'android') {

// let braveOverwrittenFiles = new Set();
// const removeUnlistedAndroidResources = (braveOverwrittenFiles) => {
// const suspectedDir = path.join(config.srcDir, 'chrome', 'android', 'java', 'res')

// let untrackedChromiumFiles = util.runGit(suspectedDir, ['ls-files', '--others', '--exclude-standard'], true).split('\n')
// let untrackedChromiumPaths = [];
// for (const untrackedChromiumFile of untrackedChromiumFiles) {
// untrackedChromiumPath = path.join(suspectedDir, untrackedChromiumFile)

// if (!fs.statSync(untrackedChromiumPath).isDirectory()) {
// untrackedChromiumPaths.push(untrackedChromiumPath);
// }
// }

// const isChildOf = (child, parent) => {
// const relative = path.relative(parent, child);
// return relative && !relative.startsWith('..') && !path.isAbsolute(relative);
// }

// for (const untrackedChromiumPath of untrackedChromiumPaths) {
// if (isChildOf(untrackedChromiumPath, suspectedDir) && !braveOverwrittenFiles.has(untrackedChromiumPath)) {
// fs.removeSync(untrackedChromiumPath);
// console.log(`Deleted not listed file: ${untrackedChromiumPath}`);
// }
// }
// }
if (config.targetOS === 'android') {

// let androidIconSet = ''
// if (config.channel === 'development') {
// androidIconSet = 'res_brave_default'
// }
// else if (config.channel === '') {
// androidIconSet = 'res_brave'
// } else if (config.channel === 'beta') {
// androidIconSet = 'res_brave_beta'
// } else if (config.channel === 'dev') {
// androidIconSet = 'res_brave_dev'
// } else if (config.channel === 'nightly') {
// androidIconSet = 'res_brave_nightly'
// }
let braveOverwrittenFiles = new Set();
const removeUnlistedAndroidResources = (braveOverwrittenFiles) => {
const suspectedDir = path.join(config.srcDir, 'chrome', 'android', 'java', 'res')

let untrackedChromiumFiles = util.runGit(suspectedDir, ['ls-files', '--others', '--exclude-standard'], true).split('\n')
let untrackedChromiumPaths = [];
for (const untrackedChromiumFile of untrackedChromiumFiles) {
untrackedChromiumPath = path.join(suspectedDir, untrackedChromiumFile)

if (!fs.statSync(untrackedChromiumPath).isDirectory()) {
untrackedChromiumPaths.push(untrackedChromiumPath);
}
}

const isChildOf = (child, parent) => {
const relative = path.relative(parent, child);
return relative && !relative.startsWith('..') && !path.isAbsolute(relative);
}

for (const untrackedChromiumPath of untrackedChromiumPaths) {
if (isChildOf(untrackedChromiumPath, suspectedDir) && !braveOverwrittenFiles.has(untrackedChromiumPath)) {
fs.removeSync(untrackedChromiumPath);
console.log(`Deleted not listed file: ${untrackedChromiumPath}`);
}
}
}

let androidIconSet = ''
if (config.channel === 'development') {
androidIconSet = 'res_brave_default'
}
else if (config.channel === '') {
androidIconSet = 'res_brave'
} else if (config.channel === 'beta') {
androidIconSet = 'res_brave_beta'
} else if (config.channel === 'dev') {
androidIconSet = 'res_brave_dev'
} else if (config.channel === 'nightly') {
androidIconSet = 'res_brave_nightly'
}

// const androidTranslateResSource = path.join(config.braveCoreDir, 'components', 'translate','content' , 'android', 'java', 'res')
// const androidTranslateResDest = path.join(config.srcDir, 'components', 'translate','content' , 'android', 'java', 'res')
Expand Down Expand Up @@ -621,28 +621,28 @@ const util = {
// [androidSafeBrowsingResSource]: [androidSafeBrowsingResDest]
// }

// console.log('copy Android app icons and app resources')
// Object.entries(copyAndroidResourceMapping).map(([sourcePath, destPaths]) => {
// let androidSourceFiles = []
// if (fs.statSync(sourcePath).isDirectory()) {
// androidSourceFiles = util.walkSync(sourcePath)
// } else {
// androidSourceFiles = [sourcePath]
// }

// for (const destPath of destPaths) {
// for (const androidSourceFile of androidSourceFiles) {
// let destinationFile = path.join(destPath, path.relative(sourcePath, androidSourceFile))
// if (!fs.existsSync(destinationFile) || util.calculateFileChecksum(androidSourceFile) != util.calculateFileChecksum(destinationFile)) {
// fs.copySync(androidSourceFile, destinationFile)
// }
// braveOverwrittenFiles.add(destinationFile);
// }
// }
// })
// removeUnlistedAndroidResources(braveOverwrittenFiles)
// }
Log.progressFinish('update branding for whitelabel')
console.log('copy Android app icons and app resources')
Object.entries(copyAndroidResourceMapping).map(([sourcePath, destPaths]) => {
let androidSourceFiles = []
if (fs.statSync(sourcePath).isDirectory()) {
androidSourceFiles = util.walkSync(sourcePath)
} else {
androidSourceFiles = [sourcePath]
}

for (const destPath of destPaths) {
for (const androidSourceFile of androidSourceFiles) {
let destinationFile = path.join(destPath, path.relative(sourcePath, androidSourceFile))
if (!fs.existsSync(destinationFile) || util.calculateFileChecksum(androidSourceFile) != util.calculateFileChecksum(destinationFile)) {
fs.copySync(androidSourceFile, destinationFile)
}
braveOverwrittenFiles.add(destinationFile);
}
}
})
removeUnlistedAndroidResources(braveOverwrittenFiles)
}
Log.progressFinish('update branding')
},

touchOverriddenChromiumSrcFiles: () => {
Expand Down Expand Up @@ -1084,4 +1084,4 @@ const util = {
},
}

module.exports = util
module.exports = util
135 changes: 25 additions & 110 deletions components/ai_chat/resources/page/chat_ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,121 +3,36 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

import * as React from 'react'
import { render } from 'react-dom'
import { initLocale } from 'brave-ui'
import { setIconBasePath } from '@brave/leo/react/icon'
// import { initLocale } from 'brave-ui'
// import * as React from 'react'
// import { render } from 'react-dom'

import '$web-components/app.global.scss'
import '@brave/leo/tokens/css/variables.css'

import { loadTimeData } from '$web-common/loadTimeData'
import BraveCoreThemeProvider from '$web-common/BraveCoreThemeProvider'
import Main from './components/main'
import ConversationList from './components/conversation_list'
import InputBox from './components/input_box'
import PrivacyMessage from './components/privacy_message'
import { useConversationHistory, useInput, useAgreement } from './state/hooks'
import getPageHandlerInstance, { AutoGenerateQuestionsPref } from './api/page_handler'
import SiteTitle from './components/site_title'
import PromptAutoSuggestion from './components/prompt_auto_suggestion'
import '$web-common/defaultTrustedTypesPolicy'
// import { loadTimeData } from '$web-common/loadTimeData'
// import BraveCoreThemeProvider from '$web-common/BraveCoreThemeProvider'
// import Main from './components/main'
// import DataContextProvider from './state/data-context-provider'

setIconBasePath('chrome-untrusted://resources/brave-icons')

function App () {
const model = useConversationHistory()
const { value, setValue } = useInput();
const { hasSeenAgreement, handleAgreeClick } = useAgreement()

const handleInputChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
const target = e.target as HTMLTextAreaElement
setValue(target.value)
}

const handleSubmit = (e: any) => {
if (!value) return
e.preventDefault()
getPageHandlerInstance().pageHandler.submitHumanConversationEntry(value)
setValue('')
}

const handleQuestionSubmit = (question: string) => {
getPageHandlerInstance().pageHandler.submitHumanConversationEntry(question)
}

const handleOnEnableAutoGenerateQuestion = () => {
model.setUserAllowsAutoGenerating(true)
model.generateSuggestedQuestions()
}

const handlePageContentDisconnect = () => {
getPageHandlerInstance().pageHandler.disconnectPageContents()
}

let conversationList = <PrivacyMessage />
let siteTitleElement = null
let promptAutoSuggestionElement = null

if (hasSeenAgreement) {
conversationList = (
<>
<ConversationList
list={model.conversationHistory}
isLoading={model.isGenerating}
suggestedQuestions={model.suggestedQuestions}
onQuestionSubmit={handleQuestionSubmit}
/>
</>
)

if (model.siteInfo) {
siteTitleElement = (
<SiteTitle
siteInfo={model.siteInfo}
favIconUrl={model.favIconUrl}
onDisconnectButtonClick={handlePageContentDisconnect}
/>
)
}

if (model.userAutoGeneratePref === AutoGenerateQuestionsPref.Unset && model.canGenerateQuestions) {
promptAutoSuggestionElement = (
<PromptAutoSuggestion
onEnable={handleOnEnableAutoGenerateQuestion}
onDismiss={() => model.setUserAllowsAutoGenerating(false)}
/>
)
}
}

const inputBox = (
<InputBox
value={value}
onInputChange={handleInputChange}
onSubmit={handleSubmit}
onKeyDown={handleSubmit}
hasSeenAgreement={hasSeenAgreement}
onHandleAgreeClick={handleAgreeClick}
/>
)

return (
<BraveCoreThemeProvider>
<Main
conversationList={conversationList}
inputBox={inputBox}
siteTitle={siteTitleElement}
promptAutoSuggestion={promptAutoSuggestionElement}
onSettingsClick={() => getPageHandlerInstance().pageHandler.openBraveLeoSettings()}
onEraseClick={() => getPageHandlerInstance().pageHandler.clearConversationHistory()}
/>
</BraveCoreThemeProvider>
)
}

function initialize () {
initLocale(loadTimeData.data_)
render(<App />, document.getElementById('mountPoint'))
}

document.addEventListener('DOMContentLoaded', initialize)
// function App () {
// return (
// <DataContextProvider>
// <BraveCoreThemeProvider>
// <Main />
// <></>
// </BraveCoreThemeProvider>
// </DataContextProvider>
// )
// }

// function initialize () {
// initLocale(loadTimeData.data_)
// render( <></>, document.getElementById('mountPoint'))
// }

// document.addEventListener('DOMContentLoaded', initialize)
30 changes: 15 additions & 15 deletions components/brave_new_tab_ui/components/default/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ import * as React from 'react'

// Feature-specific components
import {
// IconButton,
// IconButtonContainer,
// IconButtonSideText,
IconLink,
Label,
Link,
Navigation,
IconButton,
IconButtonContainer,
IconButtonSideText,
IconLink,
PhotoName
} from '..'
import * as S from '../page'

// Items
import {
SettingsIcon,
SettingsAdvancedIcon,
BookmarkBook,
HistoryIcon
HistoryIcon,
// SettingsIcon,
SettingsAdvancedIcon
} from 'brave-ui/components/icons'

import BraveTalkIcon from './braveTalkIcon'
// import BraveTalkIcon from './braveTalkIcon'

// Helpers
import { getLocale } from '../../../../common/locale'
Expand All @@ -41,11 +41,11 @@ export interface Props {
export default class FooterInfo extends React.PureComponent<Props, {}> {
render () {
const {
textDirection,
supportsBraveTalk,
// textDirection,
// supportsBraveTalk,
backgroundImageInfo,
showPhotoInfo,
onClickSettings
// onClickSettings
} = this.props

return (
Expand All @@ -65,14 +65,14 @@ export default class FooterInfo extends React.PureComponent<Props, {}> {
}
<S.GridItemNavigation>
<Navigation>
<IconButtonContainer textDirection={textDirection}>
{/* <IconButtonContainer textDirection={textDirection}>
<IconButtonSideText textDirection={textDirection}>
<IconButton onClick={onClickSettings}>
<SettingsIcon />
</IconButton>
{getLocale('customize')}
</IconButtonSideText>
</IconButtonContainer>
</IconButtonContainer> */}
<IconLink title={getLocale('preferencesPageTitle')} href='chrome://settings'>
<SettingsAdvancedIcon />
</IconLink>
Expand All @@ -82,11 +82,11 @@ export default class FooterInfo extends React.PureComponent<Props, {}> {
<IconLink title={getLocale('historyPageTitle')} href='chrome://history'>
<HistoryIcon />
</IconLink>
{ supportsBraveTalk &&
{/* { supportsBraveTalk &&
<IconLink title={getLocale('braveTalkPromptTitle')} href='https://talk.brave.com/widget'>
<BraveTalkIcon />
</IconLink>
}
} */}
</Navigation>
</S.GridItemNavigation>
</>
Expand Down
Loading

0 comments on commit 8f47a1a

Please sign in to comment.